tests edit

This commit is contained in:
Ruidy Nemausat 2020-06-09 22:11:29 +02:00
parent c553fb97ea
commit 43da7d4645
2 changed files with 45 additions and 0 deletions

34
rental/tests/booking.py Normal file
View 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
View 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)