v0.8.6 release info
[hermes] / package / test / unit / test_syncjob.py
1 import unittest
2 from org.maemo.hermes.engine.syncjob import SyncJob
3
4 class FakeContact():
5     def __init__(self):
6         pass
7     
8 class FakeService():
9     def __init__(self):
10         self.contacts_preprocessed = []
11         self.contacts_processed = []
12     def get_name(self):
13         return "fake service"
14     def pre_process_contact(self, contact):
15         self.contacts_preprocessed.append(contact)
16     def process_friends(self):
17         pass
18     def process_contact(self, contact):
19         self.contacts_processed.append(contact)
20      
21     
22 class TestSyncJob(unittest.TestCase):
23     
24     def setUp(self):
25         self.service = FakeService() 
26         self.services = [self.service]
27         self.contact = FakeContact()
28         self.contacts = [self.contact]
29         self.testee = SyncJob(self.services, self.contacts)
30         
31     def test_main_flow(self):
32         self.testee.run()
33         assert self.contact in self.service.contacts_preprocessed
34         assert self.contact in self.service.contacts_processed
35     
36 if __name__ == '__main__':
37     unittest.main()