def test_error(self): course = mommy.save_one(Course) old_properties = course.to_dict() template_response = save(course.key.id()) errors = template_response.context['errors'] self.assertSetEqual(set(['nome']), set(errors.keys())) self.assertEqual(old_properties, course.key.get().to_dict()) self.assert_can_render(template_response)
def test_success(self): course = mommy.save_one(Course) old_properties = course.to_dict() redirect_response = save(course.key.id(), nome='nome_string') self.assertIsInstance(redirect_response, RedirectResponse) edited_course = course.key.get() self.assertEquals('nome_string', edited_course.nome) self.assertNotEqual(old_properties, edited_course.to_dict())