Skip to content

Commit 33572c2

Browse files
author
Leandro Rosemberg
committed
It is not good to have a global response
1 parent c72dfce commit 33572c2

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

tests/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,6 @@ def setUp(self):
210210
status=200,
211211
)
212212

213-
# Upload image
214-
responses.add(
215-
responses.POST,
216-
f"{API_URL}/dataset/{PROJECT_NAME}/upload?api_key={ROBOFLOW_API_KEY}" f"&batch={DEFAULT_BATCH_NAME}",
217-
json={"duplicate": True, "id": "hbALkCFdNr9rssgOUXug"},
218-
status=200,
219-
)
220-
221213
self.connect_to_roboflow()
222214

223215
def tearDown(self):

tests/test_project.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
from tests import RoboflowTest
1+
import responses
2+
3+
from roboflow import API_URL
4+
from roboflow.config import DEFAULT_BATCH_NAME
5+
from tests import RoboflowTest, PROJECT_NAME, ROBOFLOW_API_KEY
26

37

48
class TestProject(RoboflowTest):
59
def test_check_valid_image_with_accepted_formats(self):
10+
# Mock dataset upload
11+
responses.add(
12+
responses.POST,
13+
f"{API_URL}/dataset/{PROJECT_NAME}/upload?api_key={ROBOFLOW_API_KEY}" f"&batch={DEFAULT_BATCH_NAME}",
14+
json={"duplicate": True, "id": "hbALkCFdNr9rssgOUXug"},
15+
status=200,
16+
)
17+
618
images_to_test = [
719
"rabbit.JPG",
820
"rabbit2.jpg",
@@ -14,6 +26,14 @@ def test_check_valid_image_with_accepted_formats(self):
1426
self.assertTrue(self.project.check_valid_image(f"tests/images/{image}"))
1527

1628
def test_check_valid_image_with_unaccepted_formats(self):
29+
# Mock dataset upload
30+
responses.add(
31+
responses.POST,
32+
f"{API_URL}/dataset/{PROJECT_NAME}/upload?api_key={ROBOFLOW_API_KEY}" f"&batch={DEFAULT_BATCH_NAME}",
33+
json={"duplicate": True, "id": "hbALkCFdNr9rssgOUXug"},
34+
status=200,
35+
)
36+
1737
images_to_test = [
1838
"sky-rabbit.gif",
1939
"sky-rabbit.heic",

0 commit comments

Comments
 (0)