def test_getKeyForAPINone(self): """ If there is no existing key for the named API, L{APIKey.getKeyForAPI} should return C{None}. """ self.assertIdentical( APIKey.getKeyForAPI(self.store, u'this is an API name.'), None)
def render_urchin(self, ctx, data): """ Render the code for recording Google Analytics statistics, if so configured. """ key = APIKey.getKeyForAPI(self._siteStore(), APIKey.URCHIN) if key is None: return '' return ctx.tag.fillSlots('urchin-key', key.apiKey)
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_urchinKey(self): """ Specifying a Google Analytics key inserts an item into the database recording it. """ opt = webcmd.WebConfiguration() opt.parent = self opt['urchin-key'] = 'A123' opt.postOptions() self.assertEquals(APIKey.getKeyForAPI(self.store, APIKey.URCHIN).apiKey, u'A123')
def test_urchinKey(self): """ Specifying a Google Analytics key inserts an item into the database recording it. """ opt = webcmd.WebConfiguration() opt.parent = self opt['urchin-key'] = 'A123' opt.postOptions() self.assertEquals( APIKey.getKeyForAPI(self.store, APIKey.URCHIN).apiKey, u'A123')
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))