示例#1
0
def test__health_check_with_wrong_token():
    client = Client(account_id="wrong_account",
                    access_token="wrong_key",
                    start_date="2019-03-03T10:00")
    alive, error = client.health_check()

    assert not alive
    assert error == "Error: 190, Invalid OAuth access token."
示例#2
0
def test__campaigns_with_wrong_token():
    client = Client(account_id="wrong_account",
                    access_token="wrong_key",
                    start_date="2019-03-03T10:00")
    with pytest.raises(FacebookAPIException,
                       match="Error: 190, Invalid OAuth access token"):
        next(
            client.read_stream(AirbyteStream(name="campaigns",
                                             json_schema={})))
示例#3
0
def client_fixture(some_config, requests_mock, fb_account_response):
    client = Client(**some_config)
    requests_mock.register_uri("GET",
                               FacebookSession.GRAPH + "/v10.0/me/adaccounts",
                               [fb_account_response])
    return client
示例#4
0
def test__campaigns_with_wrong_token(config_with_wrong_token):
    client = Client(**config_with_wrong_token)
    with pytest.raises(FacebookAPIException, match="Error: 190, Invalid OAuth access token"):
        next(client.read_stream(AirbyteStream(name="campaigns", json_schema={})))
示例#5
0
def test__health_check_with_wrong_token(config_with_wrong_token):
    client = Client(**config_with_wrong_token)
    alive, error = client.health_check()

    assert not alive
    assert error == "Error: 190, Invalid OAuth access token."