Skip to content

Commit 33bdd72

Browse files
committed
Fix tests
1 parent 5e7da40 commit 33bdd72

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

superannotate/db/users.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def get_team_contributor_metadata(email):
6262
if user["email"] == email:
6363
results.append(user)
6464

65-
if len(results) > 1 or len(results) == 0:
65+
if len(results) == 0:
66+
raise SABaseException(0, "No user with email " + email + " found.")
67+
if len(results) > 1:
6668
raise SABaseException(0, "Email " + email + " malformed.")
6769
return results[0]

tests/test_assign_images.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ def test_assign_images(tmpdir):
1616
sa.delete_project(project)
1717

1818
project = sa.create_project(PROJECT_NAME_VECTOR, "test", "Vector")
19-
sa.share_project(project, "hovnatan@superannotate.com", "QA")
19+
email = sa.get_team_metadata()["users"][0]["email"]
20+
sa.share_project(project, email, "QA")
2021

2122
sa.upload_images_from_folder_to_project(
2223
project, "./tests/sample_project_vector"
2324
)
2425

2526
sa.assign_images(
26-
project, ["example_image_1.jpg", "example_image_2.jpg"],
27-
"hovnatan@superannotate.com"
27+
project, ["example_image_1.jpg", "example_image_2.jpg"], email
2828
)
2929

3030
time.sleep(1)
3131
im1_metadata = sa.get_image_metadata(project, "example_image_1.jpg")
3232
im2_metadata = sa.get_image_metadata(project, "example_image_2.jpg")
3333

34-
assert im1_metadata["qa_id"] == "hovnatan@superannotate.com"
35-
assert im2_metadata["qa_id"] == "hovnatan@superannotate.com"
34+
assert im1_metadata["qa_id"] == email
35+
assert im2_metadata["qa_id"] == email
3636

37-
sa.unshare_project(project, "hovnatan@superannotate.com")
37+
sa.unshare_project(project, email)
3838

3939
time.sleep(1)
4040

@@ -46,19 +46,17 @@ def test_assign_images(tmpdir):
4646
assert im1_metadata["annotator_id"] is None
4747
assert im2_metadata["annotator_id"] is None
4848

49-
sa.share_project(project, "hovnatan@superannotate.com", "Annotator")
49+
sa.share_project(project, email, "Annotator")
5050

5151
sa.assign_images(
52-
project, ["example_image_1.jpg", "example_image_2.jpg"],
53-
"hovnatan@superannotate.com"
52+
project, ["example_image_1.jpg", "example_image_2.jpg"], email
5453
)
5554

5655
time.sleep(1)
5756
im1_metadata = sa.get_image_metadata(project, "example_image_1.jpg")
5857
im2_metadata = sa.get_image_metadata(project, "example_image_2.jpg")
5958

60-
assert im1_metadata["annotator_id"] == "hovnatan@superannotate.com"
61-
assert im2_metadata["annotator_id"] == "hovnatan@superannotate.com"
59+
assert im1_metadata["annotator_id"] == email
60+
assert im2_metadata["annotator_id"] == email
6261
assert im1_metadata["qa_id"] is None
6362
assert im2_metadata["qa_id"] is None
64-
print(sa.get_project_metadata(PROJECT_NAME_VECTOR))

tests/test_pin_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def test_pin_image(tmpdir):
3838
assert img_metadata["is_pinned"] == 1
3939

4040
sa.pin_image(project, "example_image_1.jpg", False)
41+
time.sleep(1)
4142

4243
img_metadata = sa.get_image_metadata(project, "example_image_1.jpg")
43-
time.sleep(1)
4444
assert img_metadata["is_pinned"] == 0
4545

4646
del img_metadata["updatedAt"]

0 commit comments

Comments
 (0)