Beispiel #1
0
def test_read(param, length):
    reader = AddressReader(
        Config.get_address_config().get('source').get('class'),
        **Config.get_address_config().get('source').get('params'))
    results = reader.read(param.get('street_name'), param.get('zip_code'),
                          param.get('street_number'))
    assert len(results) == length
    if length == 1:
        address = results[0]
        assert isinstance(address, AddressRecord)
        assert address.zip_code == 4410
Beispiel #2
0
def test_read(param, length):
    source = DatabaseSource(**Config.get_address_config().get('source').get('params'))
    source.read(MockParameter(), param.get('street_name'), param.get('zip_code'), param.get('street_number'))
    assert len(source.records) == length
    if length == 1:
        address = source.records[0]
        assert isinstance(address, AddressRecord)
        assert address.zip_code == 4410
Beispiel #3
0
def test_init():
    reader = AddressReader(
        Config.get_address_config().get('source').get('class'),
        **Config.get_address_config().get('source').get('params'))
    assert isinstance(reader._source_, Base)
Beispiel #4
0
def test_missing_parameter():
    source = DatabaseSource(**Config.get_address_config().get('source').get('params'))
    with pytest.raises(TypeError):
        source.read()
Beispiel #5
0
def test_init():
    source = DatabaseSource(**Config.get_address_config().get('source').get('params'))
    assert isinstance(source._adapter_, DatabaseAdapter)
    assert source._model_ == Address