Exemplo n.º 1
0
def test_insert_no_import_images():
    """Unit test for method insert, no import images case."""
    image_database = ImageDatabase(
        data_dir=TEST_TEMP_DIRECTORY,
        import_images=False
    )

    image_database.insert(20, 'tests/test_image.jpg')

    assert not exists(f'{TEST_TEMP_DIRECTORY}/0/20.jpg') and \
        exists(f'{TEST_TEMP_DIRECTORY}/0/20.json')
Exemplo n.º 2
0
def test_insert_import_images():
    """Unit test for method insert, import images case."""
    image_database = ImageDatabase(
        data_dir=TEST_TEMP_DIRECTORY,
        import_images=True
    )

    image_database.insert(10, 'tests/test_image.jpg')

    assert exists(f'{TEST_TEMP_DIRECTORY}/0/10.jpg') \
        and exists(f'{TEST_TEMP_DIRECTORY}/0/10.json')