SHARE
TWEET

Trip_test_case

a guest Feb 18th, 2020 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from application import *
  2. import hashlib
  3. import flight
  4.  
  5.  
  6. ###
  7. # SETUP INSTRUCTIONS:
  8. # STEP 1: In Folder 'starter_code' > create a folder > ulitmate_testing_suite_a1 > Save this file underneath it as
  9. # 'Test_Multi_Agent_Fingerprint_Suite.py'
  10. # STEP 2: Add your tester name
  11. ###
  12. """
  13. Small MD5 Fingerprint : bcbced27f873b8abc6e8fbe4d3936ef6
  14. big MD5 Fingerprint : 58e4e730f1ce0e99c0b4d0d996a8d17e
  15. Small_limited MD5 Fingerprint : c8e25692ea4cd2781c7dd1d2f35fa1b2
  16. big_limited MD5 Fingerprint : 57ca3db72c6eae7fbbd94517d6800c3d
  17. """
  18. def deep_fingerprint_trip_id():
  19.     input_data_small = import_data('../data/airports.csv',
  20.                                    '../data/customers.csv',
  21.                                    '../data/segments_small.csv',
  22.                                    '../data/trips_small.csv')
  23.     input_data_big = import_data('../data/airports.csv',
  24.                                  '../data/customers.csv',
  25.                                  '../data/segments.csv', '../data/trips.csv')
  26.     small_string = ''
  27.     big_sting = ''
  28.     airports = create_airports(input_data_small[0])
  29.     customers = create_customers(input_data_small[2])
  30.  
  31.     flights_small = create_flight_segments(input_data_small[1])
  32.     trips_small = load_trips(input_data_small[3], customers, flights_small)
  33.  
  34.     flights_big = create_flight_segments(input_data_big[1])
  35.     trips_big = load_trips(input_data_big[3], customers, flights_big)
  36.  
  37.     for t in trips_small:
  38.         small_string += t.get_reservation_id() + str(t.trip_departure)
  39.         for s in t.get_flight_segments():
  40.             small_string += str(s.seat_availability)
  41.             for element in s._manifest:
  42.                 small_string += str(element)
  43.  
  44.     for t in trips_big:
  45.         big_sting += t.get_reservation_id() + str(t.trip_departure)
  46.         for s in t.get_flight_segments():
  47.             big_sting += str(s.seat_availability)
  48.             for element in s._manifest:
  49.                 big_sting += str(element)
  50.     return small_string, big_sting
  51.  
  52.  
  53. def deep_fingerprint_trip_id_limited():
  54.     input_data_small = import_data('../data/airports.csv',
  55.                                    '../data/customers.csv',
  56.                                    '../data/segments_small.csv',
  57.                                    '../data/trips_small.csv')
  58.     input_data_big = import_data('../data/airports.csv',
  59.                                  '../data/customers.csv',
  60.                                  '../data/segments.csv', '../data/trips.csv')
  61.     small_limited = ''
  62.     big_limited = ''
  63.     airports = create_airports(input_data_small[0])
  64.     customers = create_customers(input_data_small[2])
  65.  
  66.     flight.AIRPLANE_CAPACITY = {"Economy": 2, "Business": 1}
  67.     flights_small = create_flight_segments(input_data_small[1])
  68.     trips_small = load_trips(input_data_small[3], customers, flights_small)
  69.  
  70.     flights_big = create_flight_segments(input_data_big[1])
  71.     trips_big = load_trips(input_data_big[3], customers, flights_big)
  72.  
  73.     for t in trips_small:
  74.         small_limited += t.get_reservation_id() + str(t.trip_departure)
  75.         for s in t.get_flight_segments():
  76.             small_limited += str(s.seat_availability)
  77.             for element in s._manifest:
  78.                 small_limited += str(element)
  79.  
  80.     for t in trips_big:
  81.         big_limited += t.get_reservation_id() + str(t.trip_departure)
  82.         for s in t.get_flight_segments():
  83.             big_limited += str(s.seat_availability)
  84.             for element in s._manifest:
  85.                 big_limited += str(element)
  86.  
  87.     return small_limited, big_limited
  88.  
  89.  
  90. if __name__ == "__main__":
  91.     small, big = deep_fingerprint_trip_id()
  92.     small_limited, big_limited = deep_fingerprint_trip_id_limited()
  93.     print("Small MD5 Fingerprint : " + hashlib.md5(
  94.         (small).encode('utf-8')).hexdigest())
  95.     print("big MD5 Fingerprint : " + hashlib.md5(
  96.         (big).encode('utf-8')).hexdigest())
  97.     print("Small_limited MD5 Fingerprint : " + hashlib.md5(
  98.         (small_limited).encode('utf-8')).hexdigest())
  99.     print("big_limited MD5 Fingerprint : " + hashlib.md5(
  100.         (big_limited).encode('utf-8')).hexdigest())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top