コード例 #1
0
ファイル: key_test.py プロジェクト: Ads7/isbndb-py
    def test_getKey(self):
        print "Testing getKey()...",
        keys._KEYS = [fauxKey("stuff"), fauxKey("things"), fauxKey("foo")]
        keys._KEYS[0].active = False

        x = keys.getKey()
        self.assertEqual(x, "things", "FAILED (didnt get first active key)")
        x.active = False
        x = keys.getKey()
        self.assertEqual(x, "foo", "FAILED (inactivating a key didnt work)")
        keys._KEYS[0].active = True
        self.assertEqual(keys.getKey(), "stuff", "FAILED (Reactivating)")
        print "OK"
コード例 #2
0
    def test_getKey(self):
        print 'Testing getKey()...',
        keys._KEYS = [fauxKey('stuff'),fauxKey('things'),fauxKey('foo')]
        keys._KEYS[0].active = False

        x = keys.getKey()
        self.assertEqual(x, 'things','FAILED (didnt get first active key)')
        x.active = False
        x = keys.getKey()
        self.assertEqual(x,'foo','FAILED (inactivating a key didnt work)')
        keys._KEYS[0].active = True
        self.assertEqual(keys.getKey(),'stuff',"FAILED (Reactivating)")
        print "OK"
コード例 #3
0
ファイル: key_test.py プロジェクト: Ads7/isbndb-py
 def test_getKeyReturnsNoneOnOutOfKeys(self):
     print "Testing getKey() returns none on no keys...",
     keys._KEYS = [fauxKey("foo"), fauxKey("bar")]
     for x in keys._KEYS:
         x.active = False
     n = keys.getKey()
     self.assert_(n is None, "FAILED")
     print "OK"
コード例 #4
0
 def test_getKeyReturnsNoneOnOutOfKeys(self):
     print "Testing getKey() returns none on no keys...",
     keys._KEYS = [fauxKey('foo'),fauxKey('bar')]
     for x in keys._KEYS:
         x.active = False
     n = keys.getKey()
     self.assert_(n is None, "FAILED")
     print "OK"
コード例 #5
0
    def setUp(self):
        self.p = params()
        self.key = getKey()
        #set up params

        self.p.searchIndex = 'full'
        self.p.results = ['texts','details','subjects']
        self.p.searchValue = 'sex'
        self.p.key = self.key