Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)
Esempio n. 5
0
 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))
Esempio n. 6
0
    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')
Esempio n. 7
0
    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')
Esempio n. 8
0
 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))