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."
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={})))
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
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={})))
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."