def test_getKeyForAPIExisting(self): """ If there is an existing key for the named API, L{APIKey.getKeyForAPI} should return it. """ theAPIName = u'this is an API name.' existingAPIKey = APIKey(store=self.store, apiName=theAPIName, apiKey=u'this is an API key.') self.assertIdentical(existingAPIKey, APIKey.getKeyForAPI(self.store, theAPIName))
def test_setKeyForAPIExisting(self): """ If there is an existing for the named API, L{APIKey.setKeyForAPI} should update its I{apiKey} attribute. """ theAPIKey = u'this is an API key.' theAPIName = u'this is an API name.' existingAPIKey = APIKey(store=self.store, apiName=theAPIName, apiKey=theAPIKey) newAPIKey = u'this is a new API key' returnedAPIKey = APIKey.setKeyForAPI(self.store, theAPIName, newAPIKey) self.assertIdentical(existingAPIKey, returnedAPIKey) self.assertEqual(existingAPIKey.apiName, theAPIName) self.assertEqual(existingAPIKey.apiKey, newAPIKey)