Пример #1
0
 def test_checkout_fail_status(self):
     body = "checkout 2"
     expected = "not in service"
     response = handle_checkout(self.student, body)
     print(response)
     self.assertTrue(expected in response)
     self.assertLess(len(response), 161)
Пример #2
0
 def test_checkout_fail_choice(self):
     body = "checkout garbage"
     expected = "not understood"
     response = handle_checkout(self.student, body)
     print(response)
     self.assertTrue(expected in response)
     self.assertLess(len(response), 161)
Пример #3
0
 def test_checkout_success(self):
     body = "checkout 1"
     expected = "You have successfully checked out"
     response = handle_checkout(self.student, body)
     print(response)
     self.assertTrue(expected in response)
     self.assertLess(len(response), 161)
Пример #4
0
 def test_checkout_fail_busy(self):
     other_student = Student.objects.get(name="Other Student")
     make_ride(other_student, self.bike)
     timenow_string = timezone.localtime(datetime.datetime.now(pytz.utc)).strftime("%H:%M on %D")
     body = "checkout 1"
     expected1 = "still in use"
     expected2 = "checked out at "+timenow_string
     response = handle_checkout(self.student, body)
     print "PRINT TIME_NOW: " + timenow_string
     print(response)
     self.assertTrue(expected1 in response)
     self.assertTrue(expected2 in response)
     self.assertLess(len(response), 161)