Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
authorFredrik Wendt <fredrik@wendt.se>
Tue, 8 Jun 2010 23:48:09 +0000 (00:48 +0100)
committerFredrik Wendt <fredrik@wendt.se>
Tue, 8 Jun 2010 23:48:09 +0000 (00:48 +0100)
Signed-off-by: Fredrik Wendt <fredrik@wendt.se>

package/test/unit/test_twitter.py

index cdbb882..5a3be33 100644 (file)
@@ -1,5 +1,6 @@
 from org.maemo.hermes.engine.twitter.service import Service
 from org.maemo.hermes.engine.names import canonical
+from org.maemo.hermes.engine.friend import Friend
 import unittest
 
 class FakeContact():
@@ -36,6 +37,28 @@ class TestTwitterService(unittest.TestCase):
         self.testee = Service(None)
     
     
+    def test_that_process_contact_returns_None_for_unknown_contact(self):
+        contact = FakeContact('Person Person', [])
+        self._fake_server([])
+        
+        self.testee.pre_process_contact(contact);
+        self.testee.process_friends()
+        friend = self.testee.process_contact(contact)
+        assert friend is None
+        
+
+    def test_that_process_contact_returns_friend_object_if_contact_is_known(self):
+        twitterName = "Same Name"
+        known_tweeter = FakeTweeter(twitterName, "samename")
+        contact = FakeContact(twitterName, [])
+        self._fake_server([known_tweeter])
+        
+        self.testee.pre_process_contact(contact);
+        self.testee.process_friends()
+        friend = self.testee.process_contact(contact)
+        assert isinstance(friend, Friend)
+
+        
     def test_main_flow(self):
         twitterName = "Twitter Name"
         self._fake_server([FakeTweeter(twitterName, "wendtse", {"url":"http://wendt.se"})])

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment