fixed erronous gconf path in postins script (thanks to hutchinsfairy)
[wifi-assistant] / package / test / unit / pie_test.py
1 import unittest
2 from unit.pie import *
3
4 class PieTest(unittest.TestCase):
5     
6     def test_never(self):
7         mock = Mock()
8         mock.replay()
9         verify(mock, never()).fakeMethod()
10     
11     
12     def test_neverFail(self):
13         mock = Mock()
14         mock.replay()
15         mock.fakeMethod()
16         try:
17             verify(mock, never()).fakeMethod()
18             raise Exception("The fake method was called - the verify statement should fail")
19         except:
20             pass
21         
22     
23     def test_onceSuccess(self):
24         mock = Mock()
25         given(mock).method().willReturn(True)
26         mock.replay()
27         result = mock.method()
28         assert result is True
29         verify(mock, once()).method()
30     
31     
32     def test_onceFail(self):
33         mock = Mock()
34         given(mock).method().willReturn(True)
35         mock.replay()
36         try:
37             verify(mock, once()).method()
38             raise Exception("The method was never called - the verify step should fail")
39         except:
40             pass
41         
42     
43     def test_implicitOnce_undefinedReturn_WithArguments(self):
44         mock = Mock()
45         mock.replay()
46         url = 'http://sample.argument'
47         mock.openUrl(url)
48         verify(mock).openUrl(url)
49     
50
51 if __name__ == '__main__':
52     unittest.main()