Beispiel #1
0
def test_imposter_structure_roundtrip():
    # Given
    expected = ImposterBuilder().build()
    structure = expected.as_structure()

    # When
    actual = Imposter.from_structure(structure)

    # Then
    assert_that(actual, instance_of(Imposter))
    assert_that(actual, has_identical_properties_to(expected))
Beispiel #2
0
def test_imposter_structure_without_default_response_roundtrip():
    # Given
    expected = ImposterBuilder().with_default_response(None).build()
    structure = expected.as_structure()

    # When
    actual = Imposter.from_structure(structure)

    # Then
    assert_that(actual, instance_of(Imposter))
    assert_that(
        actual,
        has_identical_properties_to(expected, ignoring=["configuration_url"]))
Beispiel #3
0
def test_structure_record_requests():
    expected_imposter = ImposterBuilder().with_record_requests(False).build()
    imposter_structure = expected_imposter.as_structure()
    imposter = Imposter.from_structure(imposter_structure)
    assert imposter.record_requests is False
Beispiel #4
0
def test_structure_name():
    expected_imposter = ImposterBuilder().with_name("darwin").build()
    imposter_structure = expected_imposter.as_structure()
    imposter = Imposter.from_structure(imposter_structure)
    assert imposter.name == "darwin"
Beispiel #5
0
def test_structure_protocol():
    expected_imposter = ImposterBuilder().with_protocol("http").build()
    imposter_structure = expected_imposter.as_structure()
    imposter = Imposter.from_structure(imposter_structure)
    assert imposter.protocol == Imposter.Protocol.HTTP
Beispiel #6
0
def test_structure_port():
    expected_imposter = ImposterBuilder().with_port(4546).build()
    imposter_structure = expected_imposter.as_structure()
    imposter = Imposter.from_structure(imposter_structure)
    assert imposter.port == 4546