mirror of
https://github.com/rjNemo/villafleurie
synced 2026-06-12 13:26:47 +00:00
tests edit
This commit is contained in:
parent
c553fb97ea
commit
43da7d4645
2 changed files with 45 additions and 0 deletions
34
rental/tests/booking.py
Normal file
34
rental/tests/booking.py
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
from datetime import datetime
|
||||||
|
from django.shortcuts import get_object_or_404
|
||||||
|
from django.test import TestCase
|
||||||
|
from rental.models.place import Place
|
||||||
|
from rental.models.booking import Booking
|
||||||
|
from rental.models.guest import Guest
|
||||||
|
|
||||||
|
|
||||||
|
class BookingTestCase(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.place = Place.objects.create(
|
||||||
|
name='TX',
|
||||||
|
price=100
|
||||||
|
)
|
||||||
|
|
||||||
|
self.guest = Guest.objects.create(
|
||||||
|
name="Ruidy",
|
||||||
|
email="r@mail.com",
|
||||||
|
phone="1092198YE8939798"
|
||||||
|
)
|
||||||
|
|
||||||
|
self.start = datetime(2019, 11, 14)
|
||||||
|
self.end = datetime(2019, 11, 20)
|
||||||
|
|
||||||
|
def test_BookingPrice(self):
|
||||||
|
# place = Place.objects.get(name='TX')
|
||||||
|
booking = Booking.objects.create_booking(
|
||||||
|
place=self.place,
|
||||||
|
start=self.start,
|
||||||
|
end=self.end,
|
||||||
|
guest=self.guest
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(booking.price, 600)
|
||||||
11
rental/tests/calendar.py
Normal file
11
rental/tests/calendar.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
import rental.services.calendar as calendar
|
||||||
|
|
||||||
|
|
||||||
|
class CalendarTestCase(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_CalendarBuild(self):
|
||||||
|
obj = calendar.build_service()
|
||||||
|
print(obj)
|
||||||
Loading…
Reference in a new issue