Skip to content

Commit 74a51e2

Browse files
committed
fix: adjust api and tests for changes made on
openedx/openedx-learning#62
1 parent c890a1a commit 74a51e2

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

openedx/features/content_tagging/api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def create_taxonomy(
1818
required=False,
1919
allow_multiple=False,
2020
allow_free_text=False,
21-
system_defined=False,
2221
object_tag_class: Type = None,
2322
) -> Taxonomy:
2423
"""
@@ -33,7 +32,6 @@ def create_taxonomy(
3332
required=required,
3433
allow_multiple=allow_multiple,
3534
allow_free_text=allow_free_text,
36-
system_defined=system_defined,
3735
object_tag_class=object_tag_class,
3836
)
3937
if org_owners:

openedx/features/content_tagging/tests/test_api.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,23 @@ def test_get_taxonomies_for_org(self, org_attr, enabled, expected):
159159
]
160160

161161
@ddt.data(
162-
("taxonomy_all_orgs", "all_orgs_course_tag"),
163-
("taxonomy_all_orgs", "all_orgs_block_tag"),
164-
("taxonomy_both_orgs", "both_orgs_course_tag"),
165-
("taxonomy_both_orgs", "both_orgs_block_tag"),
166-
("taxonomy_one_org", "one_org_block_tag"),
162+
("taxonomy_all_orgs", "all_orgs_course_tag", 2),
163+
("taxonomy_all_orgs", "all_orgs_block_tag", 2),
164+
("taxonomy_both_orgs", "both_orgs_course_tag", 3),
165+
("taxonomy_both_orgs", "both_orgs_block_tag", 3),
166+
("taxonomy_one_org", "one_org_block_tag", 3),
167167
)
168168
@ddt.unpack
169169
def test_get_object_tags_valid_for_org(
170170
self,
171171
taxonomy_attr,
172172
object_tag_attr,
173+
num_queries,
173174
):
174175
taxonomy_id = getattr(self, taxonomy_attr).id
175176
taxonomy = api.get_taxonomy(taxonomy_id)
176177
object_tag = getattr(self, object_tag_attr)
177-
with self.assertNumQueries(2):
178+
with self.assertNumQueries(num_queries):
178179
valid_tags = list(
179180
api.get_object_tags(
180181
taxonomy=taxonomy,
@@ -183,7 +184,8 @@ def test_get_object_tags_valid_for_org(
183184
valid_only=True,
184185
)
185186
)
186-
assert valid_tags == [object_tag]
187+
assert len(valid_tags) == 1
188+
assert valid_tags[0].id == object_tag.id
187189

188190
@ddt.data(
189191
("taxonomy_disabled", "disabled_course_tag"),
@@ -213,7 +215,8 @@ def test_get_object_tags_include_invalid(
213215
valid_only=False,
214216
)
215217
)
216-
assert valid_tags == [object_tag]
218+
assert len(valid_tags) == 1
219+
assert valid_tags[0].id == object_tag.id
217220

218221
def test_object_tag_not_valid_check_object(self):
219222
"""

openedx/features/content_tagging/tests/test_rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def test_system_taxonomy(self, perm):
134134
"""Taxonomy administrators cannot edit system taxonomies"""
135135
system_taxonomy = api.create_taxonomy(
136136
name="System Languages",
137-
system_defined=True,
138137
)
138+
system_taxonomy.system_defined = True
139139
assert self.superuser.has_perm(perm, system_taxonomy)
140140
assert not self.staff.has_perm(perm, system_taxonomy)
141141
assert not self.user_all_orgs.has_perm(perm, system_taxonomy)

0 commit comments

Comments
 (0)