示例#1
0
    def test_http_client_get_profile(self, http_client: HttpClient):
        http_client.connect(TransportType.HTTP2)

        name = faker.name()
        avatar = faker.avatar_url().replace("#auto", "")

        http_client.user_id = ALICE_ID

        _, _ = http_client.get_profile()
        http_client.receive(self.get_profile_byte_response(name, avatar, 1))
        response = http_client.next_response()

        assert isinstance(response, ProfileGetResponse)
        assert response.displayname == name
        assert response.avatar_url.replace("#auto", "") == avatar
示例#2
0
def synced_client(tempdir):
    http_client = HttpClient("example.org", "ephemeral", "DEVICEID", tempdir)
    http_client.connect(TransportType.HTTP2)

    http_client.login("1234")
    http_client.receive(TestClass().login_byte_response)
    response = http_client.next_response()
    assert isinstance(response, LoginResponse)
    assert http_client.access_token == "ABCD"

    http_client.sync()
    http_client.receive(TestClass().sync_byte_response)
    response = http_client.next_response()
    assert isinstance(response, SyncResponse)
    assert http_client.access_token == "ABCD"

    return http_client