1 from org.maemo.hermes.engine.gravatar.service import Service
2 from org.maemo.hermes.engine.friend import Friend
6 def __init__(self, addr):
13 class IntegrationTestGravatarService(unittest.TestCase):
16 self.testee = Service('maemohermes@wendt.se', 'b14ec179822b')
18 self.existing_address = 'fredrik@wendt.se'
19 self.existing_contact = FakeContact([self.existing_address])
20 self.existing_friend = Friend("Fredrik Wendt")
22 self.missing_address = 'will_not_ever_exist_i_truly_hope_at_least@wendt.se'
23 self.missing_contact = FakeContact([self.missing_address])
24 self.missing_friend = Friend("Unknown Person")
26 self.multiple_contact = FakeContact([self.existing_address, self.missing_address])
27 self.multiple_friend = Friend("Another Person")
30 def test_main_flow(self):
31 self.testee.pre_process_contact(self.existing_contact)
32 self.testee.pre_process_contact(self.missing_contact)
33 self.testee.process_friends()
34 self.testee.process_contact(self.existing_contact)
35 self.testee.process_contact(self.missing_contact)
37 friends = self.testee.get_friends()
38 contacts = self.testee.get_contacts_with_match()
39 assert len(friends) == 1
40 assert len(contacts) == 1
41 assert self.missing_contact not in contacts.keys()
42 assert self.existing_contact in contacts.keys()
44 assert friend.get_name() == self.existing_contact.get_name()
48 if __name__ == '__main__':