Exemplo n.º 1
0
def test_interaction_setup_connection_fails(monkeypatch, mock_pact,
                                            mock_result_factory,
                                            fake_interaction):
    monkeypatch.setattr(
        requests, 'post',
        Mock(side_effect=requests.exceptions.ConnectionError('barf')))
    monkeypatch.setattr(requests, 'get', Mock())
    # monkeypatch.setattr(ResponseVerifier, 'verify', Mock())
    fake_interaction['providerState'] = 'some state'
    i = Interaction(mock_pact('2.0.0'), fake_interaction, mock_result_factory)
    i.set_versioned_provider_state('http://provider.example/pact-setup/',
                                   'state', 'some state')
    i.result.fail.assert_called_once()
Exemplo n.º 2
0
def test_interaction_setup_connection_fails(monkeypatch, mock_pact,
                                            mock_result_factory,
                                            fake_interaction):
    monkeypatch.setattr(
        requests, "post",
        Mock(side_effect=requests.exceptions.ConnectionError("barf")))
    monkeypatch.setattr(requests, "get", Mock())
    # monkeypatch.setattr(ResponseVerifier, 'verify', Mock())
    fake_interaction["providerState"] = "some state"
    i = Interaction(mock_pact("2.0.0"), fake_interaction, mock_result_factory)
    i.set_versioned_provider_state("http://provider.example/pact-setup/",
                                   "state", "some state")
    i.result.fail.assert_called_once()