コード例 #1
0
ファイル: unit.py プロジェクト: atkinson/authoritarian
 def test_account_status(self):
     authoritarian.initialise('api-key', 'account-id')
     expected_response = {'json': 'response'}
     self.response.json = expected_response 
     response = authoritarian.account_status()
     assert_equal(response, expected_response)
     self.requests.get.assert_called_once_with(
         'http://api.authoritylabs.com/account/account-id.json',
         params={'auth_token': 'api-key'})
コード例 #2
0
ファイル: unit.py プロジェクト: atkinson/authoritarian
 def test_search_immediate(self):
     authoritarian.initialise('api-key')
     authoritarian.search('your country needs you', 'google', 
         'en-us', immediate=True)
     self.requests.post.assert_called_once_with(
         'http://api.authoritylabs.com/keywords/priority',
         data={
             'auth_token': 'api-key',
             'keyword': 'your country needs you',
             'engine': 'google',
             'locale': 'en-us',
         }
     )
コード例 #3
0
ファイル: unit.py プロジェクト: atkinson/authoritarian
 def test_results(self):
     authoritarian.initialise('api-key')
     authoritarian.results('your country needs you', 'google', 
         'en-us', '2012-07-12')
     self.requests.get.assert_called_once_with(
         'http://api.authoritylabs.com/keywords/get.json',
         params={
             'auth_token': 'api-key',
             'keyword': 'your country needs you',
             'response_format': 'json',
             'engine': 'google',
             'locale': 'en-us',
             'rank_date': '2012-07-12',
         }
     )
コード例 #4
0
ファイル: unit.py プロジェクト: atkinson/authoritarian
 def test_initialise(self):
     authoritarian.initialise('api-key')
     assert_equal(authoritarian.config['api_key'], 'api-key')
     assert_equal(authoritarian.config['account_id'], None)