From 43da7d46451012e630ef875307d9901f48cc0351 Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Tue, 9 Jun 2020 22:11:29 +0200 Subject: [PATCH] tests edit --- rental/tests/booking.py | 34 ++++++++++++++++++++++++++++++++++ rental/tests/calendar.py | 11 +++++++++++ 2 files changed, 45 insertions(+) create mode 100644 rental/tests/booking.py create mode 100644 rental/tests/calendar.py diff --git a/rental/tests/booking.py b/rental/tests/booking.py new file mode 100644 index 0000000..1882fe7 --- /dev/null +++ b/rental/tests/booking.py @@ -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) diff --git a/rental/tests/calendar.py b/rental/tests/calendar.py new file mode 100644 index 0000000..64e781d --- /dev/null +++ b/rental/tests/calendar.py @@ -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) \ No newline at end of file