Skip to content

Commit

Permalink
Remove tests that used the foreign key. Remove print statement on chi…
Browse files Browse the repository at this point in the history
…ldren note return.
  • Loading branch information
Renato Oliveira committed Dec 11, 2017
1 parent dc71107 commit ec9fac9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion notto/nottoapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def get_children(self):
children = Note.objects.filter(
url_title__startswith=self.url_title+'/'
)
print(children)
return children

def has_parent(self):
Expand Down
25 changes: 0 additions & 25 deletions notto/nottoapp/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,6 @@ def setUp(self):
content='I\'m sad'
)

def test_get_children(self):
'''
Tests if the note is able to list its children, if they exist.
If they don't exist, then return an empty list.
'''
parent = Note.objects.get(url_title='parent')
loose_note = Note.objects.get(url_title='lonely_note')
children = parent.get_children()
self.assertEqual(1, len(children))
children = loose_note.get_children()
self.assertEqual(0, len(children))

def test_get_parent(self):
'''
Tests if the note is able to get its parent record, if it exists.
If it doesn't exist, then return None.
'''
child = Note.objects.get(url_title='parent/child')
parent = child.get_parent()
loose_note = Note.objects.get(url_title='lonely_note')
self.assertNotEqual(None, parent)
self.assertEqual('parent', parent.url_title)
parent = loose_note.get_parent()
self.assertEqual(None, parent)

class NoteAccessTest(TestCase):
'''
Tests of access using URLs
Expand Down

0 comments on commit ec9fac9

Please sign in to comment.