def test_delete_document(self):
     new_doc_id = dm.create_new_document(self.template.id, {'name': 'foobar'})
     documents = dm.get_all_documents()
     self.assertEquals(len(documents), 2)
     dm.delete_document(self.document)
     documents = dm.get_all_documents()
     self.assertEquals(len(documents), 1)
     self.assertEquals(documents[0].id, new_doc_id)
    def test_get_documents(self):
        documents = dm.get_all_documents()
        self.assertEquals(len(documents), 1)
        util.insert_new_document(self.template.id, name='second test doc')
        documents = dm.get_all_documents()
        self.assertEquals(len(documents), 2)

        document = dm.get_single_document(2)
        self.assertEquals(document.template_id, self.template.id)