added test files
@@ -2,6 +2,8 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from src.scan_folder import recursive_scan_folder
|
||||||
|
|
||||||
TEST_FOLDER = ".test_folder"
|
TEST_FOLDER = ".test_folder"
|
||||||
TEST_IMAGES = "tests/test_files"
|
TEST_IMAGES = "tests/test_files"
|
||||||
TEST_TEMP_FOLDER = os.path.join(TEST_FOLDER, 'Temp')
|
TEST_TEMP_FOLDER = os.path.join(TEST_FOLDER, 'Temp')
|
||||||
@@ -28,3 +30,15 @@ def copy_test_images():
|
|||||||
os.makedirs(TEST_IMAGE_FOLDER)
|
os.makedirs(TEST_IMAGE_FOLDER)
|
||||||
shutil.copy(src=os.path.join(TEST_IMAGES, 'test_image_001.JPG'), dst=TEST_TEMP_FOLDER)
|
shutil.copy(src=os.path.join(TEST_IMAGES, 'test_image_001.JPG'), dst=TEST_TEMP_FOLDER)
|
||||||
shutil.copy(src=os.path.join(TEST_IMAGES, 'test_image_002.JPG'), dst=TEST_TEMP_FOLDER)
|
shutil.copy(src=os.path.join(TEST_IMAGES, 'test_image_002.JPG'), dst=TEST_TEMP_FOLDER)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_images(brand:str, model:str):
|
||||||
|
delete_folder()
|
||||||
|
create_folders()
|
||||||
|
files = recursive_scan_folder(path=TEST_IMAGES)
|
||||||
|
for file in files:
|
||||||
|
file_name = file.split("/")[2:][0]
|
||||||
|
file_name = file_name.split("_")
|
||||||
|
if file_name[0] == brand and file_name[1] == model:
|
||||||
|
shutil.copy(src=file, dst=TEST_FOLDER)
|
||||||
|
|
||||||
|
|||||||
BIN
tests/test_files/samsung_a54_001.jpg
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
tests/test_files/samsung_a54_002.jpg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
tests/test_files/samsung_a54_003.jpg
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
tests/test_files/samsung_a54_004.jpg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
tests/test_files/samsung_a54_005.jpg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
tests/test_files/samsung_a54_006.jpg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
tests/test_files/samsung_a54_007.jpg
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
29
tests/test_with_real_data.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import unittest
|
||||||
|
|
||||||
|
from helpers.folder_helper import TEST_FOLDER
|
||||||
|
from helpers.folder_helper import copy_images
|
||||||
|
|
||||||
|
from src.meta_data_handler import get_meta_data
|
||||||
|
from src.scan_folder import recursive_scan_folder
|
||||||
|
|
||||||
|
|
||||||
|
class TestSamsung(unittest.TestCase):
|
||||||
|
def test_a54(self):
|
||||||
|
copy_images(brand="samsung", model="a54")
|
||||||
|
files = recursive_scan_folder(path=TEST_FOLDER)
|
||||||
|
meta_data = get_meta_data(images=files)
|
||||||
|
for image in meta_data:
|
||||||
|
assert image.make == "samsung"
|
||||||
|
|
||||||
|
def test_a52s(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_a14(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skip("")
|
||||||
|
class TestApple(unittest.TestCase):
|
||||||
|
def test_iphone(self):
|
||||||
|
pass
|
||||||
|
|
||||||