def test_show_rentals(self): """ Test the show_rentals method """ # Given product_id = "V0032-100" # When expected_result = { "C1955810": { "name": "Atreides, LetoII", "address": "Arrakis", "phone_number": "899-123-5432", "email_address": "*****@*****.**", }, "C3281830": { "name": "Corino, Irulan", "address": "Kaitain", "phone_number": "001-000-0002", "email_address": "*****@*****.**", }, } # Then customers = db.show_rentals(product_id) LOGGER.debug(customers) self.assertDictEqual(expected_result, customers) db._drop_collections()
def test_show_rentals(self): """ Tests the show_rentals function of Database.py :return: None """ test = show_rentals('prd003') self.assertIsInstance(test, list) self.assertLess(0, len(test))
def test_show_rentals(self): """This method tests that the correct customers are displayed for the product_id""" database.import_data('csvs', 'product_data.csv', 'customer_data.csv', 'rentals_data.csv') actual_customers1 = database.show_rentals('prd002') expected_customers1 = { 'cst001': { 'name': 'Charlie', 'address': '123 Fleet Street', 'phone_number': '1231234123' }, 'cst002': { 'name': 'Andrey', 'address': '123 Jordan Street', 'phone_number': '4564564567' } } actual_customers2 = database.show_rentals('prd009') expected_customers2 = {} self.assertEqual(actual_customers1, expected_customers1) self.assertEqual(actual_customers2, expected_customers2)
def test_show_rentals(_show_rentals): """ rentals """ students_response = l.show_rentals("prd005") assert students_response == _show_rentals