-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "capacity dates check" for dog owner search.
Capacity dates check for show only available daycares in dates range. "get_capacity_of_daycare_in_dates_range" function took from #95 . waiting for approval. Signed-off-by: tamirmatok <[email protected]>
- Loading branch information
1 parent
5009594
commit e783f61
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,14 @@ def test_dog_owner_id_is_deleted_when_dog_owner_is_deleted(self, create_order): | |
def test_daycare_id_is_deleted_when_daycare_is_deleted(self, create_order): | ||
DayCare.objects.get(id=1).delete() | ||
assert Order.objects.get(id=create_order.id).daycare_id is None | ||
|
||
def test_get_all_day_cares_available_on_dates_function(self): | ||
start_date = "2022-05-02" | ||
end_date = "2022-08-02" | ||
day_care = DayCare.create(username='testuser', email='[email protected]', password='test_password', | ||
name='name', description='test description', price_per_day=500, | ||
capacity=1, area='Center', city='Tel_aviv', address='address') | ||
assert day_care in Order.get_all_day_cares_available_on_dates(start_date, end_date) | ||
Order.create(dog_owner_id=DogOwner.objects.get(id=1), daycare_id=day_care, | ||
start_date="2022-05-02", end_date="2022-08-02", price_per_day=500).approve_order() | ||
assert day_care not in Order.get_all_day_cares_available_on_dates(start_date, end_date) |