Add tests

This commit is contained in:
google-labs-jules[bot]
2025-06-15 19:06:36 +00:00
parent a461a33dc2
commit bf9f8bbf3a
16 changed files with 3547 additions and 41 deletions

29
app/apps/users/tests.py Normal file
View File

@@ -0,0 +1,29 @@
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.urls import reverse
class UsersTestCase(TestCase):
def test_example(self):
self.assertEqual(1 + 1, 2)
def test_users_index_view_superuser(self):
# Create a superuser
superuser = User.objects.create_user(
username='superuser',
password='superpassword',
is_staff=True,
is_superuser=True
)
# Create a Client instance
client = Client()
# Log in the superuser
client.login(username='superuser', password='superpassword')
# Make a GET request to the users_index view
# Assuming your users_index view is named 'users_index' in the 'users' app namespace
response = client.get(reverse('users:users_index'))
# Assert that the response status code is 200
self.assertEqual(response.status_code, 200)