def test_import_fare_attributes_maximal(self): fare_attributes_txt = StringIO("""\ fare_id,price,currency_type,payment_method,transfers,transfer_duration p,1.25,USD,0,0,60 """) Fare.import_txt(fare_attributes_txt, self.feed) fa = Fare.objects.get() self.assertEqual(fa.transfer_duration, 60)
def test_import_fare_attributes_maximal(self): fare_attributes_txt = StringIO.StringIO("""\ fare_id,price,currency_type,payment_method,transfers,transfer_duration p,1.25,USD,0,0,60 """) Fare.import_txt(fare_attributes_txt, self.feed) fa = Fare.objects.get() self.assertEqual(fa.transfer_duration, 60)
def test_import_fare_attributes_unlimited_transfers(self): fare_attributes_txt = StringIO("""\ fare_id,price,currency_type,payment_method,transfers,transfer_duration p,1.25,USD,0,,3600 """) Fare.import_txt(fare_attributes_txt, self.feed) fa = Fare.objects.get() self.assertEqual(fa.fare_id, 'p') self.assertEqual(fa.transfers, None) self.assertEqual(fa.transfer_duration, 3600)
def test_import_fare_duplicate_fare_id(self): fare_attributes_txt = StringIO("""\ fare_id,price,currency_type,payment_method,transfers p,1.25,USD,0,0 p,1.25,USD,0,0 """) Fare.import_txt(fare_attributes_txt, self.feed) fa = Fare.objects.get() # Just one self.assertEqual(fa.feed, self.feed) self.assertEqual(fa.fare_id, 'p')
def test_import_fare_attributes_unlimited_transfers(self): fare_attributes_txt = StringIO.StringIO("""\ fare_id,price,currency_type,payment_method,transfers,transfer_duration p,1.25,USD,0,,3600 """) Fare.import_txt(fare_attributes_txt, self.feed) fa = Fare.objects.get() self.assertEqual(fa.fare_id, 'p') self.assertEqual(fa.transfers, None) self.assertEqual(fa.transfer_duration, 3600)
def test_import_fare_attributes_minimal(self): fare_attributes_txt = StringIO.StringIO("""\ fare_id,price,currency_type,payment_method,transfers p,1.25,USD,0,0 """) Fare.import_txt(fare_attributes_txt, self.feed) fa = Fare.objects.get() self.assertEqual(fa.feed, self.feed) self.assertEqual(fa.fare_id, 'p') self.assertEqual(str(fa.price), '1.25') self.assertEqual(fa.currency_type, 'USD') self.assertEqual(fa.payment_method, 0) self.assertEqual(fa.transfers, 0) self.assertEqual(fa.transfer_duration, None)