diff options
Diffstat (limited to 'apps/notes/tests/test_models.py')
-rw-r--r-- | apps/notes/tests/test_models.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/apps/notes/tests/test_models.py b/apps/notes/tests/test_models.py index ddb731e..cf21aca 100644 --- a/apps/notes/tests/test_models.py +++ b/apps/notes/tests/test_models.py @@ -1,32 +1,32 @@ from django.test import TestCase from mixer.backend.django import mixer -from notes.models import Note, Folder +from notes.models import Note, Notebook from accounts.models import User -class FolderModelTest(TestCase): +class NotebookModelTest(TestCase): def test_string_representation(self): user = mixer.blend(User, username='tpynchon') - folder = Folder(created_by=user, name="My Folder") - self.assertEqual(str(folder), "My Folder") + notebook = Notebook(owner=user, name="San Miguel Notes") + self.assertEqual(str(notebook), "San Miguel Notes") class NoteModelTest(TestCase): def setUp(self): - self.user = mixer.blend(User, username='test') + self.user = mixer.blend(User, username='tpynchon') self.note = Note.objects.create( - created_by=self.user, + owner=self.user, title="test note", - body="the body of the note", + body_text="the body of the note", url="https://luxagraf.net/", tags="mine,cool site" ) self.note.save() self.note_no_title = Note.objects.create( - created_by=self.user, - body="the body of the note", + owner=self.user, + body_text="the body of the note", url="https://luxagraf.net/", tags="mine,cool site" ) @@ -34,11 +34,11 @@ class NoteModelTest(TestCase): def test_string_representation(self): self.assertEqual(str(self.note), "test note") - self.assertEqual(str(self.note.body), "the body of the note") + self.assertEqual(str(self.note.body_text), "the body of the note") self.assertEqual(str(self.note.url), "https://luxagraf.net/") self.assertEqual(str(self.note.tags), "mine,cool site") # titleless note gets date - self.assertEqual(str(self.note_no_title), str(self.note_no_title.date_created)) + self.assertEqual(str(self.note_no_title), str(self.note_no_title.body_text)[:50]) def test_get_absolute_url(self): - self.assertEqual(str(self.note.get_absolute_url()), "/notes/%s/" % (self.note.id)) + self.assertEqual(str(self.note.get_absolute_url), "/notes/%s/%s" % (self.note.owner.username, self.note.slug)) |