示例#1
0
 def test_card_store_exit_station(self):
     oyster_card = OysterCard()
     oyster_card.top_up(10)
     oyster_card.touch_in(test_helper.victoria_station())
     oyster_card.touch_out(test_helper.aldgate_station())
     self.assertEqual(oyster_card.exit_station,
                      test_helper.aldgate_station())
示例#2
0
 def test_touch_in_touch_out_creates_a_journey(self):
     oyster_card = OysterCard()
     oyster_card.top_up(10)
     oyster_card.touch_in(test_helper.victoria_station())
     oyster_card.touch_out(test_helper.aldgate_station())
     self.assertEqual(oyster_card.journeys, test_helper.journey())
示例#3
0
 def test_card_store_entry_station(self):
     oyster_card = OysterCard()
     oyster_card.top_up(10)
     oyster_card.touch_in(test_helper.victoria_station())
     self.assertEqual(oyster_card.entry_station,
                      test_helper.victoria_station())
示例#4
0
 def test_raises_error_if_touch_in_without_min_fare(self):
     with self.assertRaises(Exception) as cm:
         oyster_card = OysterCard()
         oyster_card.top_up(2)
         oyster_card.touch_in(test_helper.victoria_station())
     self.assertEqual("Your don't have enough funds", str(cm.exception))
示例#5
0
 def test_raises_error_if_touch_in_without_credit(self):
     with self.assertRaises(Exception) as cm:
         OysterCard().touch_in(test_helper.victoria_station())
     self.assertEqual("Your don't have enough funds", str(cm.exception))
示例#6
0
 def test_is_not_in_journey_after_touch_out(self):
     oyster_card = OysterCard()
     oyster_card.top_up(10)
     oyster_card.touch_in(test_helper.victoria_station())
     oyster_card.touch_out(test_helper.aldgate_station())
     self.assertIs(oyster_card._is_in_journey(), False)
示例#7
0
 def test_is_in_journey_after_touch_in(self):
     oyster_card = OysterCard()
     oyster_card.top_up(10)
     oyster_card.touch_in(test_helper.victoria_station())
     self.assertIs(oyster_card._is_in_journey(), True)