1from Foundation import *
2from PyObjCTools.TestSupport import *
3
4try:
5    unicode
6except NameError:
7    unicode = str
8
9
10class TestNSURLHandle (TestCase):
11    def testMethods(self):
12        self.assertIsInstance(NSHTTPPropertyStatusCodeKey, unicode)
13        self.assertIsInstance(NSHTTPPropertyStatusReasonKey, unicode)
14        self.assertIsInstance(NSHTTPPropertyServerHTTPVersionKey, unicode)
15        self.assertIsInstance(NSHTTPPropertyRedirectionHeadersKey, unicode)
16        self.assertIsInstance(NSHTTPPropertyErrorPageDataKey, unicode)
17        self.assertIsInstance(NSHTTPPropertyHTTPProxy, unicode)
18        self.assertIsInstance(NSFTPPropertyUserLoginKey, unicode)
19        self.assertIsInstance(NSFTPPropertyUserPasswordKey, unicode)
20        self.assertIsInstance(NSFTPPropertyActiveTransferModeKey, unicode)
21        self.assertIsInstance(NSFTPPropertyFileOffsetKey, unicode)
22        self.assertIsInstance(NSFTPPropertyFTPProxy, unicode)
23
24        self.assertEqual(NSURLHandleNotLoaded, 0)
25        self.assertEqual(NSURLHandleLoadSucceeded, 1)
26        self.assertEqual(NSURLHandleLoadInProgress, 2)
27        self.assertEqual(NSURLHandleLoadFailed, 3)
28
29    def testMethods(self):
30        self.assertArgIsBOOL(NSURLHandle.didLoadBytes_loadComplete_, 1)
31        self.assertResultIsBOOL(NSURLHandle.canInitWithURL_)
32        self.assertArgIsBOOL(NSURLHandle.initWithURL_cached_, 1)
33        self.assertResultIsBOOL(NSURLHandle.writeProperty_forKey_)
34        self.assertResultIsBOOL(NSURLHandle.writeData_)
35
36if __name__ == "__main__":
37    main()
38