Beispiel #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': 'Павел'
     }])
Beispiel #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()
Beispiel #3
0
 def test_auth_with_token(self):
     s = TokenSession(self._token)
     with self.assertRaises(VkAuthError):
         yield from s.authorize()
     s.close()
Beispiel #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()
Beispiel #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': 'Павел'}])
Beispiel #6
0
 def test_auth_with_token(self):
     s = TokenSession(self._token)
     with self.assertRaises(VkAuthError):
         yield from s.authorize()
     s.close()