class ResponseIntegrationTestCase(TestCase): """ Test case to make sure that the Django Response model and ChatterBot Response object have a common interface. """ def setUp(self): super(ResponseIntegrationTestCase, self).setUp() statement_object = StatementObject(text='_') statement_model = StatementModel.objects.create(text='_') self.object = ResponseObject(statement_object.text) self.model = ResponseModel(statement=statement_model, response=statement_model) self.model.save() def test_serialize(self): object_data = self.object.serialize() model_data = self.model.serialize() self.assertEqual(len(object_data), len(model_data)) self.assertIn('text', object_data) self.assertIn('text', model_data) self.assertEqual(object_data['text'], model_data['text']) self.assertIn('occurrence', object_data) self.assertIn('occurrence', model_data) self.assertEqual(object_data['occurrence'], model_data['occurrence'])
class ResponseIntegrationTestCase(TestCase): """ Test case to make sure that the Django Response model and ChatterBot Response object have a common interface. """ def setUp(self): super(ResponseIntegrationTestCase, self).setUp() date_created = timezone.now() statement_object = StatementObject(text='_', created_at=date_created) statement_model = StatementModel.objects.create( text='_', created_at=date_created) self.object = ResponseObject(statement_object.text) self.model = ResponseModel(statement=statement_model, response=statement_model) def test_serialize(self): object_data = self.object.serialize() model_data = self.model.serialize() self.assertEqual(object_data, model_data)