diff --git a/Django/communicado/pages/__pycache__/models.cpython-310.pyc b/Django/communicado/pages/__pycache__/models.cpython-310.pyc index 42a0e6c6..065f56fd 100644 Binary files a/Django/communicado/pages/__pycache__/models.cpython-310.pyc and b/Django/communicado/pages/__pycache__/models.cpython-310.pyc differ diff --git a/Django/communicado/pages/static/.DS_Store b/Django/communicado/pages/static/.DS_Store index 8c40aefa..a89197ae 100644 Binary files a/Django/communicado/pages/static/.DS_Store and b/Django/communicado/pages/static/.DS_Store differ diff --git a/Django/communicado/pages/templates/pages/payment.html b/Django/communicado/pages/templates/pages/payment.html index 147fed62..84cdd0ab 100644 --- a/Django/communicado/pages/templates/pages/payment.html +++ b/Django/communicado/pages/templates/pages/payment.html @@ -177,4 +177,3 @@

Payment

- diff --git a/Django/communicado/pages/tests.py b/Django/communicado/pages/tests.py index 24e16238..54e5f68c 100644 --- a/Django/communicado/pages/tests.py +++ b/Django/communicado/pages/tests.py @@ -5,6 +5,7 @@ from .models import * from django.test import LiveServerTestCase from django.contrib.auth.hashers import make_password +from django.shortcuts import render #from selenium import webdriver #from selenium.webdriver.common.keys import Keys #from selenium.webdriver.chrome.options import Options @@ -554,4 +555,67 @@ def test_edit_event_page_success(self): self.assertEqual(response.status_code, 302) self.assertIsNotNone(event_organizer) events = Events.objects.filter(eventOrganizerID=event_organizer) - self.assertIn(event, events) \ No newline at end of file + self.assertIn(event, events) + + def test_user_account_page(self): + + user = users.objects.create( + role="Admin", + username="testuser", + email="test@example.com", + address="123 Test St" + ) + + + + response = render(None, "pages/useraccount.html", {'user': user}) + + + self.assertEqual(response.status_code, 200) + + + self.assertContains(response, '

Your Account Information

') + self.assertContains(response, 'Role: {}'.format(user.role)) + self.assertContains(response, 'Username: {}'.format(user.username)) + self.assertContains(response, 'Email: {}'.format(user.email)) + self.assertContains(response, 'Address: {}'.format(user.address)) + self.assertContains(response, 'Edit Account Details') + self.assertContains(response, 'Booking History') + + def test_payment_view_get(self): + response = self.client.get(reverse('payment')) + self.assertEqual(response.status_code, 200) + self.assertTemplateUsed(response, 'pages/payment.html') + + def test_payment_view_post_success(self): + data = { + 'card_number': '1234567890123456', + 'expiration_date': '12/25', + 'cvv': '123', + 'cardholder_name': 'John Doe' + } + response = self.client.post(reverse('payment'), data) + self.assertEqual(response.status_code, 302) + + def test_payment_view_post_invalid_card_number(self): + data = { + 'card_number': '123456', # Invalid card number + 'expiration_date': '12/25', + 'cvv': '123', + 'cardholder_name': 'John Doe' + } + response = self.client.post(reverse('payment'), data) + self.assertEqual(response.status_code, 302) + + def test_payment_page_contains_elements(self): + response = self.client.get(reverse('payment')) + + # Check if the page contains the payment form elements + self.assertContains(response, '', count=1) + self.assertContains(response, '', count=1) + self.assertContains(response, '', count=1) + self.assertContains(response, '', count=1) + self.assertContains(response, '', count=1) + + \ No newline at end of file