Skip to content

Commit

Permalink
chore: quality fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Sep 29, 2023
1 parent 6480da3 commit 929e71e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
6 changes: 3 additions & 3 deletions tests/openedx_tagging/core/tagging/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def test_tag_object(self):
# And the expected number of tags were returned
assert len(object_tags) == len(tag_list)
for index, object_tag in enumerate(object_tags):
assert object_tag.tag_id == tag_list[index].id
assert object_tag._value == tag_list[index].value
object_tag.full_clean() # Should not raise any ValidationErrors
assert object_tag.tag_id == tag_list[index].id
assert object_tag._value == tag_list[index].value # pylint: disable=protected-access
assert object_tag.taxonomy == self.taxonomy
assert object_tag.name == self.taxonomy.name
assert object_tag.object_id == "biology101"
Expand All @@ -277,7 +277,7 @@ def test_tag_object_free_text(self):
object_tag.full_clean() # Should not raise any ValidationErrors
assert object_tag.taxonomy == self.taxonomy
assert object_tag.name == self.taxonomy.name
assert object_tag._value == "Eukaryota Xenomorph"
assert object_tag._value == "Eukaryota Xenomorph" # pylint: disable=protected-access
assert object_tag.get_lineage() == ["Eukaryota Xenomorph"]
assert object_tag.object_id == "biology101"

Expand Down
4 changes: 2 additions & 2 deletions tests/openedx_tagging/core/tagging/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def test_clean(self):
with pytest.raises(ValidationError):
object_tag.full_clean()
object_tag.tag = self.tag
object_tag._value = self.tag.value
object_tag._value = self.tag.value # pylint: disable=protected-access
object_tag.full_clean()

def test_tag_case(self) -> None:
Expand Down Expand Up @@ -476,7 +476,7 @@ def test_tag_case(self) -> None:
).save()

def test_is_deleted(self):
self.taxonomy.allow_multiple=True
self.taxonomy.allow_multiple = True
self.taxonomy.save()
open_taxonomy = Taxonomy.objects.create(name="Freetext Life", allow_free_text=True, allow_multiple=True)

Expand Down
19 changes: 2 additions & 17 deletions tests/openedx_tagging/core/tagging/test_system_defined_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,6 @@ class EmptyTestClass:
"""


class InvalidModelTaxonomy(ModelSystemDefinedTaxonomy):
"""
Model used for testing
"""

@property
def object_tag_class(self):
return EmptyTestClass

class Meta:
proxy = True
managed = False
app_label = "oel_tagging"


class TestLPTaxonomy(ModelSystemDefinedTaxonomy):
"""
Model used for testing - points to LearningPackage instances
Expand Down Expand Up @@ -210,7 +195,7 @@ def test_tag_object_resync(self):
api.tag_object(self.author_taxonomy, [self.user_1.username], object2_id)
initial_object_tags = api.get_object_tags(object1_id)
assert [t.value for t in initial_object_tags] == [self.user_1.username]
assert list(api.get_object_tags(other_obj_id)) == []
assert not list(api.get_object_tags(other_obj_id))
# Change user_1's username:
new_username = "new_username"
self.user_1.username = new_username
Expand All @@ -222,7 +207,7 @@ def test_tag_object_resync(self):
# This is good - all the objects throughout the system with this tag now show the new value.
assert [t.value for t in api.get_object_tags(object2_id)] == [new_username]
# And just to make sure there are no other random changes to other objects:
assert list(api.get_object_tags(other_obj_id)) == []
assert not list(api.get_object_tags(other_obj_id))

def test_tag_object_delete_user(self):
"""
Expand Down

0 comments on commit 929e71e

Please sign in to comment.