diff --git a/tests/test_rest_app.py b/tests/test_rest_app.py index d6101d1..2189390 100644 --- a/tests/test_rest_app.py +++ b/tests/test_rest_app.py @@ -138,6 +138,18 @@ class CollectionTestBase(unittest.TestCase): self.collection.addNote(note) + def add_default_note(self, count=1): + data = { + 'model': 'Basic', + 'fields': { + 'Front': 'The front', + 'Back': 'The back', + }, + 'tags': "Tag1 Tag2", + } + for idx in range(0, count): + self.add_note(data) + class CollectionHandlerTest(CollectionTestBase): def setUp(self): super(CollectionHandlerTest, self).setUp() @@ -189,15 +201,7 @@ class CollectionHandlerTest(CollectionTestBase): self.assertEqual(ret, []) # add a note programatically - note = { - 'model': 'Basic', - 'fields': { - 'Front': 'The front', - 'Back': 'The back', - }, - 'tags': "Tag1 Tag2", - } - self.add_note(note) + self.add_default_note() # get the id for the one note on this collection note_id = self.collection.findNotes('')[0] @@ -313,15 +317,7 @@ class DeckHandlerTest(CollectionTestBase): self.assertEqual(ret, None) # add a note programatically - note = { - 'model': 'Basic', - 'fields': { - 'Front': 'The front', - 'Back': 'The back', - }, - 'tags': "Tag1 Tag2", - } - self.add_note(note) + self.add_default_note() # get the id for the one card and note on this collection note_id = self.collection.findNotes('')[0] @@ -335,6 +331,12 @@ class DeckHandlerTest(CollectionTestBase): self.assertEqual(ret['answer'], 'The front\n\n