def test_show_available_products(self): """ Test the show_available_product data from database """ # Given expected_result = { "V0032-100": { "description": "Spice Harvester", "product_type": "Electric", "quantity_available": "2", }, "T0072-401": { "description": "Thumper", "product_type": "Electric", "quantity_available": "100", }, "F1001-223": { "description": "Harkonnen Chair", "product_type": "Furniture", "quantity_available": "23", }, "F1001-052": { "description": "Chair dog", "product_type": "Furniture", "quantity_available": "14", }, } # When products = db.show_available_products() # Then self.assertDictEqual(expected_result, products)
def test_show_available_products(self): """ Tests the shoe available products list of database.py :return: none """ return_available_products = show_available_products() self.assertIsInstance(return_available_products, list) self.assertLess(0, len(return_available_products))
def test_show_available(self): """This method tests that all and only available products are displayed""" database.import_data('csvs', 'product_data.csv', 'customer_data.csv', 'rentals_data.csv') actual_available = database.show_available_products() expected_available = { 'prd001': { 'description': 'TV', 'product_type': 'livingroom', 'quantity_available': '3' }, 'prd002': { 'description': 'Couch', 'product_type': 'livingroom', 'quantity_available': '1' } } self.assertEqual(actual_available, expected_available) database.delete_database() database.import_data('csvs', 'produc_data.csv', 'customer_data.csv', 'rentals_data.csv') database.delete_database()
def test_show_available_products(_show_available_products): """ available products """ students_response = l.show_available_products() assert students_response == _show_available_products