示例#1
0
async def test_token_session_auth_token_request_without_token(vk_server):
    url = f'http://{vk_server.host}:{vk_server.port}'
    s = TokenSession('token')
    s.REQUEST_URL = f'{url}/method/'
    with pytest.raises(VkAuthError):
        await s.send_api_request('users.get.error', {'user_ids': 1})
    await s.close()
示例#2
0
async def test_token_session_auth_token_free_request_without_token(
        vk_server, user_1_data):
    url = f'http://{vk_server.host}:{vk_server.port}'
    s = TokenSession()
    s.REQUEST_URL = f'{url}/method/'
    result = await s.send_api_request('users.get', {'user_ids': 1})
    await s.close()
    assert result == user_1_data
示例#3
0
 async def test_auth_token_request_without_token(self):
     s = TokenSession('token')
     s.REQUEST_URL = 'https://{}/method/'.format(self.base_url)
     with self.assertRaises(VkAuthError):
         await s.send_api_request('users.get.error', {'user_ids': 1})
     await s.close()
示例#4
0
 async def test_auth_token_free_request_without_token(self):
     s = TokenSession()
     s.REQUEST_URL = 'https://{}/method/'.format(self.base_url)
     result = await s.send_api_request('users.get', {'user_ids': 1})
     await s.close()
     self.assertListEqual(result, [{'id': 1, 'last_name': 'Дуров', 'first_name': 'Павел'}])