Exemple #1
0
 def test_index(self):
     tester = app.test_client(self)
     response = tester.get('/trainfee',
                           query_string=dict(
                               origin_station='colombo fort',
                               destination_station='maradana'))
     self.assertEqual(response.status_code, 200)
Exemple #2
0
 def test_incorrect_respose(self):
     tester = app.test_client(self)
     response = tester.get('/busfee',
                           query_string=dict(origin='aaaaa',
                                             destination='bbbbb'))
     self.assertTrue(b'sorry!please enter a valid origin and destination:('
                     in response.data)
Exemple #3
0
 def test_response(self):
     tester = app.test_client(self)
     response = tester.get('/busfee',
                           query_string=dict(origin='colombo',
                                             destination='matara'))
     self.assertTrue(
         b'From: COLOMBO To: MATARA Normal bus fees is Rs: 223 semi luxary bus fees is Rs: 335 air conditioned bus fees is Rs: 445'
         in response.data)
Exemple #4
0
 def test_response(self):
     tester = app.test_client(self)
     response = tester.get('/trainfee',
                           query_string=dict(
                               origin_station='ColomboFort',
                               destination_station='Maradana'))
     print(response.data)
     self.assertTrue(
         b'From: ColomboFort To: Maradana on track number 1,    1st class price is Rs: 40    2nd class price is Rs: 20    3rd class price is Rs: 10 '
         in response.data)
Exemple #5
0
 def test_empty_inputs(self):
     tester = app.test_client(self)
     response = tester.get('/busfee',
                           query_string=dict(destination='matara'))
     self.assertEqual(response.status_code, 400)
 def test_index(self):
     tester = app.test_client(self)
     response = tester.get(
         '/traintimes', query_string=dict(origin='matara', destination='galle'))
     self.assertEqual(response.status_code, 200)
 def test_response(self):
     tester = app.test_client(self)
     response = tester.get(
         '/traintimes', query_string=dict(origin='matara', destination='galle'))
     self.assertIn(
         b'The next train is scheduled to depart at' or b'no train will run after this moment for today',response.data)