mirror of https://github.com/snachodog/mybuddy.git
Fix tests
This commit is contained in:
parent
bd78149db3
commit
e5279f2d7a
|
@ -132,7 +132,7 @@ class NoteSerializer(TaggitSerializer, CoreModelSerializer):
|
||||||
model = models.Note
|
model = models.Note
|
||||||
fields = ("id", "child", "note", "time", "tags")
|
fields = ("id", "child", "note", "time", "tags")
|
||||||
|
|
||||||
tags = TagListSerializerField()
|
tags = TagListSerializerField(required=False)
|
||||||
|
|
||||||
|
|
||||||
class SleepSerializer(CoreModelWithDurationSerializer):
|
class SleepSerializer(CoreModelWithDurationSerializer):
|
||||||
|
|
|
@ -251,13 +251,14 @@ class NoteAPITestCase(TestBase.BabyBuddyAPITestCaseBase):
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
response = self.client.get(self.endpoint)
|
response = self.client.get(self.endpoint)
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
self.assertEqual(
|
self.assertDictEqual(
|
||||||
response.data["results"][0],
|
response.data["results"][0],
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"child": 1,
|
"child": 1,
|
||||||
"note": "Fake note.",
|
"note": "Fake note.",
|
||||||
"time": "2017-11-17T22:45:00-05:00",
|
"time": "2017-11-17T22:45:00-05:00",
|
||||||
|
"tags": [],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ from django.core.validators import RegexValidator
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from taggit.managers import TaggableManager
|
from taggit.managers import TaggableManager as TaggitTaggableManager
|
||||||
from taggit.models import TagBase, GenericTaggedItemBase, TaggedItemBase
|
from taggit.models import TagBase, GenericTaggedItemBase
|
||||||
|
|
||||||
random.seed()
|
random.seed()
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class Tagged(GenericTaggedItemBase):
|
||||||
return super().save_base(*args, **kwargs)
|
return super().save_base(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class TaggableManager(TaggableManager):
|
class TaggableManager(TaggitTaggableManager):
|
||||||
"""
|
"""
|
||||||
Remove default help_text - only reason for this to exist.
|
Remove default help_text - only reason for this to exist.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue