1
2from PyObjCTools.TestSupport import *
3from Quartz.CoreGraphics import *
4
5class TestCGSession (TestCase):
6
7    def testConstants(self):
8        self.assertEqual(kCGSessionUserIDKey, "kCGSSessionUserIDKey")
9        self.assertEqual(kCGSessionUserNameKey, "kCGSSessionUserNameKey")
10        self.assertEqual(kCGSessionConsoleSetKey, "kCGSSessionConsoleSetKey")
11        self.assertEqual(kCGSessionOnConsoleKey, "kCGSSessionOnConsoleKey")
12        self.assertEqual(kCGSessionLoginDoneKey, "kCGSessionLoginDoneKey")
13        self.assertEqual(kCGNotifyGUIConsoleSessionChanged, b"com.apple.coregraphics.GUIConsoleSessionChanged")
14        self.assertEqual(kCGNotifyGUISessionUserChanged, b"com.apple.coregraphics.GUISessionUserChanged")
15
16    def testFunctions(self):
17        v = CGSessionCopyCurrentDictionary()
18        self.assertIsInstance(v, CFDictionaryRef)
19
20        self.assertIsInstance(v[kCGSessionUserIDKey], (int, long))
21        self.assertIsInstance(v[kCGSessionUserNameKey], unicode)
22        self.assertIsInstance(v[kCGSessionConsoleSetKey], (int, long))
23        self.assertIsInstance(v[kCGSessionOnConsoleKey], bool)
24        self.assertIsInstance(v[kCGSessionLoginDoneKey], bool)
25
26
27
28if __name__ == "__main__":
29    main()
30