def test_get_bills_missing_credit_card(): mock_client = MockHttpClient() mock_client.remove_mock_url(('https://mocked-proxy-url/api/proxy/events_123', '')) mock_client.remove_mock_url(('https://mocked-proxy-url/api/token', '')) mock_client.add_mock_url('https://mocked-proxy-url/api/proxy/magnitude_123', '', 'proxy_events') mock_client.add_mock_url('https://mocked-proxy-url/api/token', '', 'discovery_login_alternative') nubank_client = Nubank(client=mock_client) nubank_client.authenticate_with_cert('1234', 'hunter12', 'some-file.p12') with pytest.raises(NuMissingCreditCard): nubank_client.get_bills()
def test_authenticate_with_cert_missing_credit_card(): mock_client = MockHttpClient() mock_client.remove_mock_url(('https://mocked-proxy-url/api/proxy/events_123', '')) mock_client.remove_mock_url(('https://mocked-proxy-url/api/token', '')) mock_client.add_mock_url('https://mocked-proxy-url/api/proxy/magnitude_123', '', 'proxy_events') mock_client.add_mock_url('https://mocked-proxy-url/api/token', '', 'discovery_login_alternative') nubank_client = Nubank(client=mock_client) nubank_client.authenticate_with_cert('1234', 'hunter12', 'some-file.p12') assert nubank_client._feed_url == 'https://mocked-proxy-url/api/proxy/magnitude_123' assert nubank_client._bills_url is None assert nubank_client._client.get_header('Authorization') == 'Bearer access_token_123'