Пример #1
0
 def test_auth_token_free_request_without_token(self):
     s = TokenSession()
     result = yield from s.send_api_request('users.get', {'user_ids': 1})
     s.close()
     self.assertListEqual(result, [{
         'id': 1,
         'last_name': 'Дуров',
         'first_name': 'Павел'
     }])
Пример #2
0
 def test_auth_token_nonfree_request_without_token(self):
     s = TokenSession()
     with self.assertRaises(VkAuthError):
         yield from s.send_api_request('messages.get')
     s.close()
Пример #3
0
 def test_auth_with_token(self):
     s = TokenSession(self._token)
     with self.assertRaises(VkAuthError):
         yield from s.authorize()
     s.close()
Пример #4
0
 def test_auth_token_nonfree_request_without_token(self):
     s = TokenSession()
     with self.assertRaises(VkAuthError):
         yield from s.send_api_request('messages.get')
     s.close()
Пример #5
0
 def test_auth_token_free_request_without_token(self):
     s = TokenSession()
     result = yield from s.send_api_request('users.get', {'user_ids': 1})
     s.close()
     self.assertListEqual(result, [{'id': 1, 'last_name': 'Дуров', 'first_name': 'Павел'}])
Пример #6
0
 def test_auth_with_token(self):
     s = TokenSession(self._token)
     with self.assertRaises(VkAuthError):
         yield from s.authorize()
     s.close()