File tree 2 files changed +34
-10
lines changed
2 files changed +34
-10
lines changed Original file line number Diff line number Diff line change @@ -78,13 +78,3 @@ def _getVal(tmpval):
78
78
elif type (tmpval ) == NSCFDictionary :
79
79
aval = dict ([(k .lower (), tmpval [k ]) for k in tmpval .keys ()])
80
80
return aval
81
-
82
- def main ():
83
- #print all()
84
- #print groups()
85
- #print me()
86
- #print getByUID('B50984C8-FEAC-4D6A-8B77-E271DB729A8E:ABPerson')
87
-
88
- if __name__ == '__main__' :
89
- main ()
90
-
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ # encoding: utf-8
3
+ """
4
+ tests.py
5
+
6
+ Unit test cases for addressbook
7
+ """
8
+ import unittest
9
+ import addressbook
10
+
11
+ class tests (unittest .TestCase ):
12
+
13
+ def testAll (self ):
14
+ """ Test retrieving all records """
15
+ self .assert_ (addressbook .all ())
16
+
17
+ def testGroups (self ):
18
+ """ Test retrieving groups """
19
+ self .assert_ (addressbook .groups ())
20
+
21
+ def testMe (self ):
22
+ """ Test retrieving current user """
23
+ self .assert_ (addressbook .me ())
24
+
25
+ def testGetByUID (self ):
26
+ """ Test getByUID """
27
+ allr = addressbook .all ()
28
+ for a in allr :
29
+ self .assert_ (addressbook .getByUID (a ['uid' ]))
30
+ break
31
+
32
+ if __name__ == '__main__' :
33
+ suite = unittest .TestLoader ().loadTestsFromTestCase (tests )
34
+ unittest .TextTestRunner (verbosity = 2 ).run (suite )
You can’t perform that action at this time.
0 commit comments