Skip to content

Commit 886aacf

Browse files
committed
Set explore url https
1 parent 9b901a4 commit 886aacf

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

src/superannotate/lib/infrastructure/services/explore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ExploreService(BaseExploreService):
3232
def explore_service_url(self):
3333
if self.client.api_url != constants.BACKEND_URL:
3434
return (
35-
f"http://explore-service.devsuperannotate.com/api/{self.API_VERSION}/"
35+
f"https://explore-service.devsuperannotate.com/api/{self.API_VERSION}/"
3636
)
3737
return f"https://explore-service.superannotate.com/api/{self.API_VERSION}/"
3838

tests/integration/classes/test_create_update_annotation_class.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import tempfile
2+
from copy import deepcopy
23

34
import pytest
45
from src.superannotate import AppException
@@ -562,6 +563,97 @@ def test_update_annotation_class_no_changes(self):
562563
len(classes[0]["attribute_groups"]),
563564
)
564565

566+
def test_update_annotation_class_duplicated_groups(self):
567+
# Create annotation class
568+
sa.create_annotation_class(
569+
self.PROJECT_NAME,
570+
"test_update_nochange",
571+
"#00FFFF",
572+
attribute_groups=[
573+
{
574+
"name": "Category",
575+
"group_type": "radio",
576+
"attributes": [{"name": "A"}, {"name": "B"}],
577+
}
578+
],
579+
)
580+
581+
# Retrieve class
582+
classes = sa.search_annotation_classes(
583+
self.PROJECT_NAME, "test_update_nochange"
584+
)
585+
586+
# Update with same data
587+
new_group = deepcopy(classes[0]["attribute_groups"][0])
588+
new_group["name"] = "New name"
589+
new_group["attributes"][0]["name"] = "New attr1"
590+
new_group["attributes"][1]["name"] = "New attr2"
591+
update_response = sa.update_annotation_class(
592+
self.PROJECT_NAME,
593+
"test_update_nochange",
594+
attribute_groups=[classes[0]["attribute_groups"][0], new_group],
595+
)
596+
# not validated response, second class that contain ids ignored
597+
assert len(update_response["attribute_groups"]) == 1
598+
assert True
599+
600+
def test_update_annotation_class_invalid_group_type(self):
601+
# Create annotation class
602+
sa.create_annotation_class(
603+
self.PROJECT_NAME,
604+
"test_update_nochange",
605+
"#00FFFF",
606+
attribute_groups=[
607+
{
608+
"name": "Category",
609+
"group_type": "radio",
610+
"attributes": [{"name": "A"}, {"name": "B"}],
611+
}
612+
],
613+
)
614+
615+
# Retrieve class
616+
classes = sa.search_annotation_classes(
617+
self.PROJECT_NAME, "test_update_nochange"
618+
)
619+
620+
classes[0]["attribute_groups"][0]["group_type"] = "invalid"
621+
with self.assertRaisesRegexp(AppException, "Invalid group_type: invalid"):
622+
sa.update_annotation_class(
623+
self.PROJECT_NAME,
624+
"test_update_nochange",
625+
attribute_groups=classes[0]["attribute_groups"],
626+
)
627+
628+
def test_update_annotation_class_without_group_type(self):
629+
# Create annotation class
630+
sa.create_annotation_class(
631+
self.PROJECT_NAME,
632+
"test_update_nochange",
633+
"#00FFFF",
634+
attribute_groups=[
635+
{
636+
"name": "Category",
637+
"group_type": "radio",
638+
"attributes": [{"name": "A"}, {"name": "B"}],
639+
}
640+
],
641+
)
642+
643+
# Retrieve class
644+
classes = sa.search_annotation_classes(
645+
self.PROJECT_NAME, "test_update_nochange"
646+
)
647+
648+
del classes[0]["attribute_groups"][0]["group_type"]
649+
with self.assertRaisesRegexp(AppException, "Invalid group_type: invalid"):
650+
res = sa.update_annotation_class(
651+
self.PROJECT_NAME,
652+
"test_update_nochange",
653+
attribute_groups=classes[0]["attribute_groups"],
654+
)
655+
assert res["attribute_groups"][0]["group_type"] == "radio"
656+
565657

566658
class TestVideoCreateAnnotationClasses(BaseTestCase):
567659
PROJECT_NAME = "TestVideoCreateAnnotationClasses"

0 commit comments

Comments
 (0)