class DocumentEngineTest(unittest.TestCase): def setUp(self): init_document_responses() self.documentengine = DocumentEngine(test_base_url, test_template_id) self.system_token = 'test_token' def tearDown(self): pass @responses.activate def test_create_documents(self): generation_id = self.documentengine.create_documents({'id': 'test_id'}, test_system_token, 'https://dgen.onroerenderfgoed.be/generations/1/document', 'POST', '1') self.assertEqual(1, generation_id) self.assertEqual(len(responses.calls), 1) self.assertEqual(responses.calls[0].request.url, 'https://dgen.onroerenderfgoed.be/generations') self.assertDictEqual(json.loads(responses.calls[0].request.body), {'template_id': test_template_id, 'template_version': '1', 'data': {'id': 'test_id'}, 'callback_method': 'POST', 'callback_url': 'https://dgen.onroerenderfgoed.be/generations/1/document'} ) @responses.activate def test_get_document(self): res = self.documentengine.get_document(1, test_system_token) self.assertEqual(data, res) self.assertEqual(len(responses.calls), 1) self.assertEqual(responses.calls[0].request.url, 'https://dgen.onroerenderfgoed.be/generations/1/document')
def setUp(self): init_document_responses() self.documentengine = DocumentEngine(test_base_url, test_template_id) self.system_token = 'test_token'