This section provides an overview of the performance tests conducted for the "New World Disorder" website. The tests were carried out using Lighthouse to evaluate key metrics such as Performance, Accessibility, Best Practices, and SEO.
- Performance: 80
- Accessibility: 86
- Best Practices: 74
- SEO: 90
- Performance: 90
- Accessibility: 86
- Best Practices: 74
- SEO: 70
- Performance: 90
- Accessibility: 87
- Best Practices: 74
- SEO: 80
- Performance: The pages generally show good performance, with scores mostly in the high range. The home page has a slightly lower score (80) due to initial load times influenced by serverless architecture and external API calls.
- Accessibility: Scores are consistently high across all pages, indicating that the website is accessible to users with disabilities.
- Best Practices: The scores suggest some improvements can be made in terms of following web development best practices.
- SEO: The SEO scores are high, reflecting that the website is well-optimized for search engines.
These performance tests highlight the strengths and areas for improvement for the "New World Disorder" website. The high scores in accessibility and SEO are particularly encouraging, indicating a user-friendly and search-engine-friendly site. Focus on optimizing best practices and performance further, especially for the home page, can enhance the overall user experience.
This section provides an overview of the CSS validation test conducted for the "New World Disorder" website. The test was carried out using the W3C CSS Validation Service to ensure that the website's stylesheets conform to the standards set by the World Wide Web Consortium (W3C).
- Standards Compliance: The validation results indicate that the website's CSS adheres to the W3C standards, ensuring cross-browser compatibility and maintainability.
- Errors and Warnings: The test highlights any errors or warnings that need to be addressed to improve the overall quality and robustness of the stylesheets.
The CSS validation test confirms that the "New World Disorder" website's stylesheets are well-formed and comply with industry standards. Addressing any highlighted errors or warnings will further enhance the website's presentation and functionality across different browsers and devices.
The following tests verify the functionality of user authentication and profile management in the application. They cover scenarios including user login, logout, registration, profile viewing, and profile updating.
This test case, TestUserViews
, includes several tests to ensure the user-related views work as expected.
Before running the tests, a test client and a user are created for use in the tests.
from django.test import TestCase, Client
from django.urls import reverse
from django.contrib.auth.models import User
class TestUserViews(TestCase):
def setUp(self):
self.client = Client()
self.user = User.objects.create_user(username='testuser', email='test@example.com', password='password')
This test checks if a user can successfully log in.
def test_user_login(self):
response = self.client.post(reverse('login'), {'username_or_email': 'testuser', 'password': 'password'})
self.assertEqual(response.status_code, 302) # Check if login is successful (redirects)
This test checks if a user can successfully log out.
def test_user_logout(self):
self.client.login(username='testuser', password='password')
response = self.client.get(reverse('logout'))
self.assertEqual(response.status_code, 302) # Check if logout is successful (redirects)
This test checks if a new user can successfully register
def test_user_register(self):
response = self.client.post(reverse('register'), {'username': 'newuser', 'email': 'new@example.com', 'password': 'password'})
self.assertEqual(response.status_code, 302) # Check if registration is successful (redirects)
This test checks if a logged-in user can view their profile.
def test_user_profile(self):
self.client.login(username='testuser', password='password')
response = self.client.get(reverse('profile'))
self.assertEqual(response.status_code, 200) # Check if profile page loads successfully
def test_update_profile(self):
self.client.login(username='testuser', password='password')
response = self.client.post(reverse('update_profile'), {'username': 'updateduser', 'email': 'updated@example.com'}, content_type='application/json')
self.assertEqual(response.status_code, 200) # Check if profile update is successful
# Check if the user object has been updated
updated_user = User.objects.get(username='updateduser')
self.assertEqual(updated_user.email, 'updated@example.com')
This documentation provides an overview of the Stripe payment integration tests implemented in our application. The tests ensure that the payment process is correctly initialized and handled.
The following JavaScript code integrates Stripe's payment elements into the application. It initializes the payment process, handles the submission of payment details, and manages the confirmation of payments.
I used the Code Institute PEP8 Validator to check that my Python code is PEP8 compliant. I validated any files that were either modified or created by me. Below is a table of the validated code, which shows the file validated, a screenshot, and a description of any warnings:
File | Screenshot | Description of Warnings |
---|---|---|
settings.py | No warnings | |
tests.py | No warnings |
This documentation provides a clear view of the validation process and any issues that were identified and addressed during development to ensure the code adheres to PEP 8 standards.