|
1 | 1 | import os |
2 | | -from unittest.mock import patch |
3 | 2 | from os.path import dirname |
| 3 | +from unittest.mock import patch |
4 | 4 |
|
5 | | -from src.superannotate import SAClient |
6 | | -sa = SAClient() |
7 | 5 | from src.superannotate import AppException |
| 6 | +from src.superannotate import SAClient |
8 | 7 | from src.superannotate.lib.core import UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE |
9 | 8 | from src.superannotate.lib.core import UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE |
10 | 9 | from src.superannotate.lib.core import UPLOAD_USER_LIMIT_ERROR_MESSAGE |
11 | | -from src.superannotate.lib.core import COPY_FOLDER_LIMIT_ERROR_MESSAGE |
12 | | -from src.superannotate.lib.core import COPY_PROJECT_LIMIT_ERROR_MESSAGE |
13 | | -from src.superannotate.lib.core import COPY_SUPER_LIMIT_ERROR_MESSAGE |
14 | 10 | from tests.integration.base import BaseTestCase |
15 | 11 | from tests.moks.limitatoins import folder_limit_response |
16 | 12 | from tests.moks.limitatoins import project_limit_response |
17 | 13 | from tests.moks.limitatoins import user_limit_response |
18 | 14 |
|
| 15 | +sa = SAClient() |
| 16 | + |
19 | 17 |
|
20 | 18 | class TestLimitsUploadImagesFromFolderToProject(BaseTestCase): |
21 | 19 | PROJECT_NAME = "TestLimitsUploadImagesFromFolderToProject" |
@@ -49,43 +47,3 @@ def test_user_limitations(self, *_): |
49 | 47 | _, _, __ = sa.upload_images_from_folder_to_project( |
50 | 48 | project=self._project["name"], folder_path=self.folder_path |
51 | 49 | ) |
52 | | - |
53 | | - |
54 | | -class TestLimitsCopyImage(BaseTestCase): |
55 | | - PROJECT_NAME = "TestLimitsCopyImage" |
56 | | - PROJECT_DESCRIPTION = "Desc" |
57 | | - PROJECT_TYPE = "Vector" |
58 | | - TEST_FOLDER_PTH = "data_set" |
59 | | - TEST_FOLDER_PATH = "data_set/sample_project_vector" |
60 | | - EXAMPLE_IMAGE_1 = "example_image_1.jpg" |
61 | | - |
62 | | - @property |
63 | | - def folder_path(self): |
64 | | - return os.path.join(dirname(dirname(__file__)), self.TEST_FOLDER_PATH) |
65 | | - |
66 | | - def test_folder_limitations(self): |
67 | | - sa.upload_image_to_project(self._project["name"], os.path.join(self.folder_path, self.EXAMPLE_IMAGE_1)) |
68 | | - sa.create_folder(self._project["name"], self._project["name"]) |
69 | | - with patch("lib.infrastructure.serviceprovider.ServiceProvider.get_limitations") as limit_response: |
70 | | - limit_response.return_value = folder_limit_response |
71 | | - with self.assertRaisesRegexp(AppException, COPY_FOLDER_LIMIT_ERROR_MESSAGE): |
72 | | - _, _, __ = sa.copy_image( |
73 | | - self._project["name"], self.folder_path, f"{self.PROJECT_NAME}/{self.PROJECT_NAME}") |
74 | | - |
75 | | - def test_project_limitations(self, ): |
76 | | - sa.upload_image_to_project(self._project["name"], os.path.join(self.folder_path, self.EXAMPLE_IMAGE_1)) |
77 | | - sa.create_folder(self._project["name"], self._project["name"]) |
78 | | - with patch("lib.infrastructure.serviceprovider.ServiceProvider.get_limitations") as limit_response: |
79 | | - limit_response.return_value = project_limit_response |
80 | | - with self.assertRaisesRegexp(AppException, COPY_PROJECT_LIMIT_ERROR_MESSAGE): |
81 | | - _, _, __ = sa.copy_image( |
82 | | - self._project["name"], self.folder_path, f"{self.PROJECT_NAME}/{self.PROJECT_NAME}") |
83 | | - |
84 | | - def test_user_limitations(self, ): |
85 | | - sa.upload_image_to_project(self._project["name"], os.path.join(self.folder_path, self.EXAMPLE_IMAGE_1)) |
86 | | - sa.create_folder(self._project["name"], self._project["name"]) |
87 | | - with patch("lib.infrastructure.serviceprovider.ServiceProvider.get_limitations") as limit_response: |
88 | | - limit_response.return_value = user_limit_response |
89 | | - with self.assertRaisesRegexp(AppException, COPY_SUPER_LIMIT_ERROR_MESSAGE): |
90 | | - _, _, __ = sa.copy_image( |
91 | | - self._project["name"], self.folder_path, f"{self.PROJECT_NAME}/{self.PROJECT_NAME}") |
0 commit comments