def scraper(): database.drop_all_collections() database.write_mars_space_facts() database.write_hi_res_mars_images() database.write_mars_stories() database.write_weather_tweets() return redirect('/')
def test_show_available_products(self): """ Unit test for the show_available_products function """ expected_result = { '001': { 'available': '25', 'description': 'Mafex Justice League Superman', 'type': '6 inch Action Figure' }, '002': { 'available': '12', 'description': 'One 12 Justice League Tactical Suit Batman', 'type': '6 inch Action Figure' }, '003': { 'available': '1', 'description': 'S.H. Figuarts Iron Man Mark LXXXV', 'type': '6 inch Action Figure' }, '004': { 'available': '15', 'description': 'Black Series Stormtrooper', 'type': '6 inch Action Figure' } } database.drop_all_collections() database.import_data("../csv_files", "products.csv", "customers.csv", "rentals.csv") self.assertDictEqual(expected_result, database.show_available_products())
def test_import_data_errors(self): """ Unit test for the error count of the import_data function """ database.drop_all_collections() record_total, error_total = database.import_data( "csv_files", "products.csv", "customers.csv", "rentals.csv") self.assertEqual((0, 0, 0), record_total) self.assertEqual((1, 1, 1), error_total)
def test_get_timing_data(self): """ Unit test for the show_available_products function """ database.drop_all_collections() database.import_data("../csv_files", "products.csv", "customers.csv", "rentals.csv") database.show_available_products() database.show_rentals("005") database.drop_all_collections()
def test_show_rentals(self): """ Unit test for the show_rentals function """ expected_result = { "001": { "id": "001", "first_name": "Bruce", "last_name": "Wayne", "address": "1007 Mountain Drive Gotham", "phone_number": "228-626-7699", "email": "*****@*****.**" }, "003": { "id": "003", "first_name": "Tony", "last_name": "Stark", "address": "10880 Malibu Point", "phone_number": "4766626769", "email": "*****@*****.**" } } database.drop_all_collections() database.import_data("../csv_files", "products.csv", "customers.csv", "rentals.csv") self.assertDictEqual(expected_result, database.show_rentals("005"))