예제 #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))
예제 #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"]))
예제 #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
예제 #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"
예제 #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
예제 #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