Exemplo n.º 1
0
def main(argv=None):
    """Database main function
    """
    args = parse_cmd_arguments(argv)

    if args.disable_log:
        logger.disable("__main__")
        logger.disable("src.database_operations")

    if args.all_products:
        pprint(db.list_all_products())

    elif args.available_products:
        pprint(db.show_available_products())

    elif args.all_customers:
        pprint(db.list_all_customers())

    elif args.drop_collections:
        db.drop_collections()

    elif args.drop_database:
        db.drop_database()

    elif args.rentals_for_customer:
        pprint(db.rentals_for_customer(args.rentals_for_customer))

    elif args.customers_renting_product:
        pprint(db.show_rentals(args.customers_renting_product))

    elif args.insert:
        pprint(db.import_data(*args.insert))
def test_list_all_customers(_list_all_customers):
    """ customers """
    l.drop_database()
    l.insert_to_mongo("./data/customers.csv")
    my_response = l.list_all_customers()
    assert my_response == _list_all_customers
def test_list_all_customers(_list_all_customers):
    """ customers """
    my_response = l.list_all_customers()
    assert my_response == _list_all_customers