Fix tests

This commit is contained in:
Paul Konstantin Gerke 2022-03-02 23:31:11 +01:00
parent bd78149db3
commit e5279f2d7a
3 changed files with 6 additions and 5 deletions

View File

@ -132,7 +132,7 @@ class NoteSerializer(TaggitSerializer, CoreModelSerializer):
model = models.Note
fields = ("id", "child", "note", "time", "tags")
tags = TagListSerializerField()
tags = TagListSerializerField(required=False)
class SleepSerializer(CoreModelWithDurationSerializer):

View File

@ -251,13 +251,14 @@ class NoteAPITestCase(TestBase.BabyBuddyAPITestCaseBase):
def test_get(self):
response = self.client.get(self.endpoint)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(
self.assertDictEqual(
response.data["results"][0],
{
"id": 1,
"child": 1,
"note": "Fake note.",
"time": "2017-11-17T22:45:00-05:00",
"tags": [],
},
)

View File

@ -14,8 +14,8 @@ from django.core.validators import RegexValidator
import random
from taggit.managers import TaggableManager
from taggit.models import TagBase, GenericTaggedItemBase, TaggedItemBase
from taggit.managers import TaggableManager as TaggitTaggableManager
from taggit.models import TagBase, GenericTaggedItemBase
random.seed()
@ -135,7 +135,7 @@ class Tagged(GenericTaggedItemBase):
return super().save_base(*args, **kwargs)
class TaggableManager(TaggableManager):
class TaggableManager(TaggitTaggableManager):
"""
Remove default help_text - only reason for this to exist.
"""