@@ -737,6 +737,7 @@ class TestOrgContentLibraryGlobData(TestCase):
737737 ("lib:Org+WithPlus:*" , False ),
738738 ("lib:(Org):*" , False ),
739739 ("lib:Org" , False ),
740+ ("lib:Org*" , False ),
740741 ("other:DemoX:*" , False ),
741742 ("lib:DemoX:*:*" , False ),
742743 )
@@ -752,14 +753,18 @@ def test_validate_external_key(self, external_key, expected_valid):
752753 ("lib:Org:With:Colon:*" , "Org:With:Colon" ),
753754 ("lib:DemoX" , None ),
754755 ("lib:DemoX:+*" , None ),
756+ ("lib:DemoX*" , None ),
757+ ("lib:DemoX:**" , None ),
758+ ("lib:DemoX:suffix" , None ),
755759 )
756760 @unpack
757761 def test_get_org (self , external_key , expected_org ):
758762 """Test organization extraction from library glob pattern."""
759763 self .assertEqual (OrgContentLibraryGlobData .get_org (external_key ), expected_org )
760764
761- def test_exists_true_when_org_has_libraries_in_db (self ):
762- """exists() returns True when at least one library with the org exists in the DB."""
765+ @patch ("openedx_authz.api.data.Organization" , Organization )
766+ def test_exists_true_when_org_exists (self ):
767+ """exists() returns True when the org exists."""
763768 org_name = "DemoX"
764769 organization = Organization .objects .create (short_name = org_name )
765770 ContentLibrary .objects .create (org = organization , slug = "testlib" , title = "Test Library" )
@@ -768,8 +773,8 @@ def test_exists_true_when_org_has_libraries_in_db(self):
768773
769774 self .assertTrue (result )
770775
771- def test_exists_false_when_org_does_not_exist_in_db (self ):
772- """exists() returns False when the org does not exist in the DB ."""
776+ def test_exists_false_when_org_does_not_exist (self ):
777+ """exists() returns False when the org does not exist."""
773778 org_name = "DemoX"
774779
775780 result = OrgContentLibraryGlobData (external_key = f"lib:{ org_name } :*" ).exists ()
@@ -806,6 +811,7 @@ class TestOrgCourseOverviewGlobData(TestCase):
806811 ("course-v1:(Org)+*" , False ),
807812 ("course-v1:Org:With:Plus+*" , False ),
808813 ("course-v1:OpenedX" , False ),
814+ ("course-v1:OpenedX*" , False ),
809815 ("other:OpenedX+*" , False ),
810816 ("course-v1:OpenedX**" , False ),
811817 )
@@ -819,6 +825,10 @@ def test_validate_external_key(self, external_key, expected_valid):
819825 ("course-v1:My-Org_1+*" , "My-Org_1" ),
820826 ("course-v1:Org.with.dots+*" , "Org.with.dots" ),
821827 ("course-v1:Org:With:Plus+*" , "Org:With:Plus" ),
828+ ("course-v1:OpenedX" , None ),
829+ ("course-v1:OpenedX*" , None ),
830+ ("course-v1:OpenedX+**" , None ),
831+ ("course-v1:OpenedX+suffix" , None ),
822832 )
823833 @unpack
824834 def test_get_org (self , external_key , expected_org ):
0 commit comments