Exemplo n.º 1
0
def format_success_response_check(instance: TestCase, res: HttpResponse):
  body = json.loads(res.content)

  instance.assertLess(res.status_code, 300)
  instance.assertLess(body.get('status'), 300)
  instance.assertIsNotNone(body.get('message'))
  instance.assertIsNotNone(body.get('data'))
  instance.assertIsInstance(body.get('data'), dict)
Exemplo n.º 2
0
 def test_removeCourse_courseNotExists(self):
     """
         Test tries to remove a course that does not exist,
         then makes sure that the other courses are not affected.
     """
     allCourses = self.myCourseCatalog.searchCoursesThroughPartialName(" ")
     TestCase.assertEqual(
         self, len(allCourses), 3,
         "There are not the correct amount of courses in the database")
     self.myCourseCatalog.removeCourseWithSections("COEN", 341)
     allCourses = self.myCourseCatalog.searchCoursesThroughPartialName(" ")
     TestCase.assertLess(self, len(allCourses), 4,
                         "One or many courses have been added")
     TestCase.assertGreater(self, len(allCourses), 2,
                            "One or many courses have been removed")