mirror of
https://github.com/rjNemo/villafleurie
synced 2026-06-06 02:16:47 +00:00
tests
This commit is contained in:
parent
5edc4fc675
commit
1f9531d2d8
3 changed files with 9 additions and 38 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import datetime
|
||||
from google.auth.transport.requests import Request
|
||||
from google_auth_oauthlib.flow import InstalledAppFlow
|
||||
from google_auth_oauthlib.flow import InstalledAppFlow, Flow
|
||||
from googleapiclient.discovery import build
|
||||
import os.path
|
||||
import os
|
||||
import pickle
|
||||
from villafleurie.settings import BASE_DIR
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
|
@ -31,8 +31,13 @@ def build_service():
|
|||
else:
|
||||
SECRETS = os.path.join(BASE_DIR, 'rental/client_secrets.json')
|
||||
flow = InstalledAppFlow.from_client_secrets_file(
|
||||
# flow = Flow.from_client_secrets_file(
|
||||
SECRETS, scopes=SCOPES, redirect_uri="http://localhost:8080/")
|
||||
creds = flow.run_local_server()
|
||||
# creds = flow.run_console()
|
||||
|
||||
# auth_url, _ = flow.authorization_url(prompt='consent')
|
||||
# print(auth_url)
|
||||
|
||||
with open('token.pickle', 'wb') as token:
|
||||
pickle.dump(creds, token)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
<h3 class="title-d">
|
||||
<a
|
||||
target="blank"
|
||||
href="https://ruidywebsite.herokuapp.com/"
|
||||
href="https://ruidyportfolio.herokuapp.com/"
|
||||
class="link-two"
|
||||
>Ruidy NEMAUSAT</a
|
||||
>
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
</li>
|
||||
<li class="list-inline-item">
|
||||
<a
|
||||
href="https://ruidywebsite.herokuapp.com/"
|
||||
href="https://ruidyportfolio.herokuapp.com/"
|
||||
class="link-one"
|
||||
target="blank"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
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)
|
||||
Loading…
Reference in a new issue