diff --git a/tests/misc/pytest.ini b/pytest.ini similarity index 100% rename from tests/misc/pytest.ini rename to pytest.ini diff --git a/tests/TEST-README.md b/tests/TEST-README.md new file mode 100644 index 0000000..3bd804e --- /dev/null +++ b/tests/TEST-README.md @@ -0,0 +1,35 @@ +# Installation & Test Execution Guide + +## 1. Setting Up Dependencies +Before launching tests, you need to install the required dependencies. There are two options: +### A. Using the current environment: +```bash +pip install -r misc/requirements.txt +``` +### B. Creating a separate Conda environment: +```bash +conda create --name facesdk_python_tests python=3.8 +``` +```bash +conda activate facesdk_python_tests +pip install -r misc/requirements.txt +``` + +## 2. Running the Tests + +Run the tests using: +```bash +pytest -v +``` + +## 3. Configuration +Ensure you refer to the file `tests/misc/paths_and_urls.py` for paths to images and service URLs. Make sure to use the correct URL. + +## 4. Generating Allure Report +You can access the run using report portal on http://172.20.40.141:8080/ + +To run tests with report portal use +```bash +pytest -v --reportportal +``` +Happy Testing! diff --git a/tests/Tests_detect.py b/tests/Tests_detect.py index 248503e..062ea60 100644 --- a/tests/Tests_detect.py +++ b/tests/Tests_detect.py @@ -4,7 +4,7 @@ from regula.facesdk.webclient.gen.model.detect_request import DetectRequest from regula.facesdk.webclient.gen.model.process_param import ProcessParam from regula.facesdk.webclient.gen.model.crop import Crop -from misc.paths_and_urls import * +from tests.misc.paths_and_urls import * import pytest import base64 @@ -75,13 +75,12 @@ def test_outputImageParams(facesdk, detect_setup): def test_quality(facesdk, detect_setup): - attributes = DetectRequestAttributes(config=[{'name': 'Age', 'range': [5, 45]}]) quality_request = QualityRequest( background_match_color=[128, 128, 128], config=[{"name": "Roll", "range": [-5, 5]}] ) params = ProcessParam(quality=quality_request) - request = DetectRequest(image=detect_setup[1], process_param=params, attributes=attributes) + request = DetectRequest(image=detect_setup[1], process_param=params) response = create_dictionary(facesdk.matching_api.detect(request)) basic_assertions(response) detection = response['results']['detections'][0] @@ -101,8 +100,3 @@ def test_attributes(facesdk, detect_setup): assert attribute_details[0]['name'] == 'Age' assert 5 <= attribute_details[0]['value'][0] <= 45 assert 5 <= attribute_details[0]['value'][1] <= 45 - - -def test_without_attributes(facesdk, detect_setup): - request = DetectRequest(image=detect_setup[0]) - facesdk.matching_api.detect(request) diff --git a/tests/Tests_group.py b/tests/Tests_group.py index c273c89..52cc50f 100644 --- a/tests/Tests_group.py +++ b/tests/Tests_group.py @@ -1,7 +1,7 @@ from regula.facesdk.webclient.gen.model.group_to_create import GroupToCreate from regula.facesdk.webclient.gen.model.person_fields import PersonFields from regula.facesdk.webclient.gen.model.update_group import UpdateGroup -from misc.paths_and_urls import * +from tests.misc.paths_and_urls import * import pytest test_group_name = "test" diff --git a/tests/Tests_matching.py b/tests/Tests_matching.py index c836c03..63b7587 100644 --- a/tests/Tests_matching.py +++ b/tests/Tests_matching.py @@ -1,6 +1,6 @@ from regula.facesdk.webclient.gen.model.image_source import ImageSource from regula.facesdk.webclient import MatchImage, MatchRequest -from misc.paths_and_urls import * +from tests.misc.paths_and_urls import * def validate_response(response, expected_detections_count, expected_first, expected_second=None): diff --git a/tests/Tests_person.py b/tests/Tests_person.py index be03746..c07b16d 100644 --- a/tests/Tests_person.py +++ b/tests/Tests_person.py @@ -3,7 +3,7 @@ from regula.facesdk.webclient.gen.model.person_fields import PersonFields import regula -from misc.paths_and_urls import * +from tests.misc.paths_and_urls import * import pytest test_name = "test" @@ -78,8 +78,8 @@ def test_get_person_images(group_and_person_setup): response = facesdk.person_api.get_all_images_by_person_id(page=1, size=1, person_id=person_id) response_dict = create_dictionary(response) assert 'items' in response_dict, "'items' key not found in the response dictionary" - assert "id" in response_dict["items"], 'id of photo not found' - assert "path" in response_dict["items"], 'path of photo not found' + assert "id" in response_dict["items"][0], 'id of photo not found' + assert "path" in response_dict["items"][0], 'path of photo not found' def test_person_groups(group_and_person_setup): diff --git a/tests/Tests_search.py b/tests/Tests_search.py index 7f150c9..c1996e2 100644 --- a/tests/Tests_search.py +++ b/tests/Tests_search.py @@ -4,7 +4,7 @@ from regula.facesdk.webclient.gen.model.search_request import SearchRequest from regula.facesdk.webclient.gen.model.person_fields import PersonFields from regula.facesdk.webclient.gen.model.crop import Crop -from misc.paths_and_urls import * +from tests.misc.paths_and_urls import * import pytest base_metadata = {'description': 'This is a test group'} diff --git a/tests/misc/requirements.txt b/tests/misc/requirements.txt index a87656a..d422d96 100644 --- a/tests/misc/requirements.txt +++ b/tests/misc/requirements.txt @@ -1,5 +1,14 @@ -pytest +pytest~=7.4.3 requests allure-pytest -regula.facesdk.webclient -pytest-reportportal \ No newline at end of file +pytest-reportportal +certifi==2023.7.22 +six>=1.10 +python-dateutil>=2.5.3 +urllib3>=1.26.18 +vistir>=0.4.0,<=0.6.1 +setuptools>=21.0.0 +pipenv-setup +wheel +twine +chardet