def test_when_exists_finds_existing_venue_location_and_categories(test_conn): test_cursor = test_conn.cursor() builder = adapters.Builder() venue_objs = builder.run(venue_details, test_conn, test_cursor) venue = venue_objs['venue'] location = venue_objs['location'] venue_categories = venue_objs['venue_categories'] zipcode = location.zipcode(test_cursor) city = zipcode.city(test_cursor) state = city.state(test_cursor) new_venue_objs = builder.run(venue_details, test_conn, test_cursor) new_venue = new_venue_objs['venue'] new_location = new_venue_objs['location'] new_venue_categories = new_venue_objs['venue_categories'] new_zipcode = location.zipcode(test_cursor) new_city = new_zipcode.city(test_cursor) new_state = new_city.state(test_cursor) assert venue.id == new_venue.id assert location.id == new_location.id assert city.id == new_city.id assert state.id == new_state.id assert zipcode.id == new_zipcode.id assert location.id == new_location.id assert venue_categories[0].id == new_venue_categories[0].id
def __init__(self): self.client = adapters.Client() self.builder = adapters.Builder() self.conn = psycopg2.connect(database='foursquare_development', user='******', password='******') self.cursor = self.conn.cursor()
def __init__(self): self.client = adapters.Client() self.builder = adapters.Builder() # read these values of database, and user from settings.py, which reads from .env self.conn = psycopg2.connect(database='three_one_one_development', user='******') self.cursor = self.conn.cursor()
def __init__(self): self.TowerSensor_Client = adapters.TowerSensor_Client() self.builder = adapters.Builder() # change to reference environmental variables, also connect to database in the db file, to keep DRY self.conn = psycopg2.connect(database='mobilegaming_development', user='******', password='******') self.cursor = self.conn.cursor()
def __init__(self): self.client = adapters.HotelClient() self.builder = adapters.Builder() self.conn = psycopg2.connect(database=DB_NAME, host=DB_HOST, user=DB_USER, password=DB_PASSWORD) self.cursor = self.conn.cursor() self.hotel_list = hotel_ids_str(hotel_csv)
def test_update_revenue_downloads_bigger_value_update(test_conn): test_cursor = test_conn.cursor() builder = adapters.Builder() game_objs = builder.run(s3d_details, s3d_record_date, s3d_rank_type, test_conn, test_cursor) game = game_objs['game'] same_earnings = game.earnings(s3d_higher, test_conn, test_cursor) assert same_earnings.revenue == 2000 assert same_earnings.downloads == 22000000
def test_with_existing_game(test_conn): test_cursor = test_conn.cursor() builder = adapters.Builder() game_objs = builder.run(TS_details, search_date, rank_type, test_conn, test_cursor) game_objs = builder.run(TS_details, search_date, rank_type, test_conn, test_cursor) game = game_objs['game'] assert game.name == 'Among Us' assert game.exists == True
def test_with_non_existing_game(test_conn): test_cursor = test_conn.cursor() builder = adapters.Builder() # great that have TS_details in other file, but move search date and rank_type into here game_objs = builder.run(TS_details, search_date, rank_type, test_conn, test_cursor) game = game_objs['game'] earnings = game_objs['earnings'] rating = game_objs['rating'] assert game.name == 'Among Us' assert game.platform == 'android' assert game.game_engine == 'Unity' assert earnings.revenue == 2000000 assert earnings.price == 0 assert rating.TS_rating == Decimal('4.45') assert rating.date_created == datetime.date(2020, 12, 28)
def test_when_does_not_exist_builds_new_venue_location_and_categories( test_conn): test_cursor = test_conn.cursor() builder = adapters.Builder() venue_objs = builder.run(venue_details, test_conn, test_cursor) venue = venue_objs['venue'] location = venue_objs['location'] venue_categories = venue_objs['venue_categories'] zipcode = location.zipcode(test_cursor) city = zipcode.city(test_cursor) state = city.state(test_cursor) assert venue.name == 'Los Tacos Al Pastor' assert venue.foursquare_id == '5b2932a0f5e9d70039787cf2' assert location.latitude == Decimal('40.70243624175102') assert location.longitude == Decimal('-73.98753900608666') assert zipcode.code == 11201 assert city.name == 'New York' assert state.name == 'NY' assert venue_categories[0].category(test_cursor).name == 'Taco Place'
def test_when_imperfect_data_exists_builds_new_venue_location_and_categories( test_conn): test_cursor = test_conn.cursor() builder = adapters.Builder() venue_objs = builder.run(imperfect_venue_details, test_conn, test_cursor) venue = venue_objs['venue'] location = venue_objs['location'] venue_categories = venue_objs['venue_categories'] zipcode = location.zipcode(test_cursor) city = zipcode.city(test_cursor) state = city.state(test_cursor) assert venue.name == 'Country Boys Tacos' assert venue.foursquare_id == '53aefe43498ec970f3cf4aea' assert location.latitude == Decimal('40.699322354013994') assert location.longitude == Decimal('-73.97475273514199') assert zipcode.code == None assert city.name == 'Brooklyn' assert state.name == 'NY' assert venue_categories[0].category(test_cursor).name == 'Food Truck'
def test_try_sibling_params_if_None_update(test_conn): test_cursor = test_conn.cursor() builder = adapters.Builder() amongus_ios_objs_1st = builder.run(amongus_ios, '2020-12-20', 'top free', test_conn, test_cursor) assert amongus_ios_objs_1st['game'].genre == '[6014, 7001, 7015]' assert amongus_ios_objs_1st['game'].game_engine == None assert amongus_ios_objs_1st['game'].release_date == None amongus_android_objs = builder.run(TS_details, '2020-12-28', 'top free', test_conn, test_cursor) amongus_ios_objs_2nd = builder.run(amongus_ios, '2020-12-20', 'top free', test_conn, test_cursor) # just retrieve from dict once -> game = game_objs['game'] assert amongus_ios_objs_2nd['game'].genre == 'action' assert amongus_ios_objs_2nd['game'].game_engine == 'Unity' assert amongus_ios_objs_2nd['game'].release_date == datetime.date( 2018, 7, 25)
def __init__(self): self.client = adapters.Client() self.builder = adapters.Builder() self.conn = db.conn self.cursor = self.conn.cursor()