From 02020111badd005bd6cb3b4f37d08af2bd7e27c6 Mon Sep 17 00:00:00 2001 From: juftin Date: Thu, 25 Apr 2024 18:39:24 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20usedirect=20startdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- camply/providers/usedirect/usedirect.py | 3 ++- tests/debug_camply.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/debug_camply.py diff --git a/camply/providers/usedirect/usedirect.py b/camply/providers/usedirect/usedirect.py index 29008a46..0e0553b2 100644 --- a/camply/providers/usedirect/usedirect.py +++ b/camply/providers/usedirect/usedirect.py @@ -304,11 +304,12 @@ def get_campsites_response( ------- UseDirectAvailabilityResponse """ + greatest_start = max(start_date, date.today() - timedelta(days=1)) data = { "IsADA": is_ada, "MinVehicleLength": min_vehicle_length, "UnitCategoryId": unit_category_id, - "StartDate": start_date.strftime(UseDirectConfig.DATE_FORMAT), + "StartDate": greatest_start.strftime(UseDirectConfig.DATE_FORMAT), "WebOnly": web_only, "UnitTypesGroupIds": [] if unit_type_group_ids is None diff --git a/tests/debug_camply.py b/tests/debug_camply.py new file mode 100644 index 00000000..625a18a3 --- /dev/null +++ b/tests/debug_camply.py @@ -0,0 +1,23 @@ +""" +Debugging Script +""" + +from tests.conftest import CamplyRunner + + +def test_debug_usedirect(cli_runner: CamplyRunner) -> None: + """ + Debug the Camply CLI - ReserveCalifornia - UseDirect + + https://reservecalifornia.com/Web/#!park/726/737 + """ + test_command = """ + camply \ + campsites \ + --provider ReserveCalifornia \ + --campground 737 \ + --start-date 2024-04-29 \ + --end-date 2024-04-30 + """ + result = cli_runner.run_camply_command(command=test_command) + assert result.exit_code == 0