def test(): data = load_acceptance_test(__file__) actual = PactRequest(headers=[]) expected = PactRequest(headers=[]) test_result = match(actual, expected) assert type(test_result) is Right
def test(): data = load_acceptance_test(__file__) actual = PactRequest(**data['actual']) expected = PactRequest(**data['expected']) test_result = match(actual, expected) assert type(test_result) is Left
def test_order_of_headers(): data = load_acceptance_test(__file__) response = PactResponse(headers=[('Accept', 'hippos, alligators')]) interaction = {'response': {'headers': data['expected']['headers']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_matching_plain_text(): data = load_acceptance_test(__file__) response = PactResponse(body='alligator named mary') interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Right
def test_unexpected_number(): data = load_acceptance_test(__file__) response = PactResponse(body={'alligator': {'feet': 4}}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_empty_headers(): data = load_acceptance_test(__file__) response = PactResponse(headers=[]) interaction = {'response': {'headers': data['expected']['headers']}} test_result = match(interaction, response) assert type(test_result) is Right
def test_not_null(): data = load_acceptance_test(__file__) response = PactResponse(body={'alligator': {'name': None}}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_different_value_at_key(): data = load_acceptance_test(__file__) response = PactResponse(body={'alligator': {'name': 'Fred'}}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Left
def test(): data = load_acceptance_test(__file__) actual = PactRequest(headers=[{'ACCEPT': 'alligators'}]) expected = PactRequest(headers=[{'Accept': 'alligators'}]) test_result = match(actual, expected) assert type(test_result) is Right
def test_different_case(): data = load_acceptance_test(__file__) response = PactResponse(body={'alligator': {'favouritecolour': 'red'}}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_different_value_case(): data = load_acceptance_test(__file__) response = PactResponse(headers=[('Accept', 'Alligators')]) interaction = {'response': {'headers': data['expected']['headers']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_missing_index(): data = load_acceptance_test(__file__) response = PactResponse(body={'alligator': {'favouriteColours': ['red']}}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_whitespaces_after_comma(): data = load_acceptance_test(__file__) response = PactResponse(headers=[('Accept', 'alligators, hippos')]) interaction = {'response': {'headers': data['expected']['headers']}} test_result = match(interaction, response) assert type(test_result) is Right
def test_headers_match(): data = load_acceptance_test(__file__) response = PactResponse(headers=[('Accept', 'alligators'), ('Content-Type', 'hippos')]) interaction = {'response': {'headers': data['expected']['headers']}} test_result = match(interaction, response) assert type(test_result) is Right
def test(): data = load_acceptance_test(__file__) actual = PactRequest(**data['actual']) expected = PactRequest(**data['expected']) actual.headers = [{'Content-Type': 'text/plain'}] expected.headers = [{'Content-Type': 'text/plain'}] test_result = match(actual, expected) assert type(test_result) is Right
def test_different_values(): data = load_acceptance_test(__file__) response = PactResponse(body={ 'favouriteColours': ['red', 'blue'], 'favouriteNumber': 7 }) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Right
def test_array_in_different_order(): data = load_acceptance_test(__file__) response = PactResponse( body={'alligator': { 'favouriteColours': ['blue', 'red'] }}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_different_values(): data = load_acceptance_test(__file__) response = PactResponse( body={'alligator': { 'favouriteNumbers': ['1', 2, '3'] }}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Left
def test_different_case(): data = load_acceptance_test(__file__) response = PactResponse( body={'alligator': { 'name': 'Mary', 'phoneNumber': None }}) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Right
def test_different_status(): data = load_acceptance_test(__file__) response = PactResponse(status=400) interaction = {'response': {'status': data['expected']['status']}} test_result = match(interaction, response).value assert test_result == { 'status': FAILED, 'message': data['comment'], 'expected': data['expected']['status'], 'actual': 400 }
def test_matches(): data = load_acceptance_test(__file__) response = PactResponse(body={ 'alligator': { 'feet': 4, 'name': 'Mary', 'favouriteColours': [ 'red', 'blue' ] } }) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Right
def test_nested_objects(): data = load_acceptance_test(__file__) response = PactResponse(body={ 'object1': { 'object2': { 'object4': { 'object5': { 'name': 'Mary', 'friends': ['Fred', 'John'], 'gender': 'F' }, 'object6': { 'phoneNumber': 1234567890 } } }, 'color': 'red' } }) interaction = {'response': {'body': data['expected']['body']}} test_result = match(interaction, response) assert type(test_result) is Right