Skip to content

Commit

Permalink
test.vieuws.py update
Browse files Browse the repository at this point in the history
  • Loading branch information
CrzyHAX91 authored Nov 26, 2024
1 parent 26462d2 commit dc5a5fd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dropship_project/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,22 @@ def test_home_view(self):
self.assertContains(response, 'Welcome to Dropship V2')

def test_dashboard_view(self):
self.client.login(username='testuser', password='testpassword')
self.client.force_login(self.user)
response = self.client.get(reverse('user_dashboard'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'User Dashboard')

def test_profile_view(self):
self.client.login(username='testuser', password='testpassword')
self.client.force_login(self.user)
response = self.client.get(reverse('user_profile'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'User Profile')

def test_login_required_dashboard(self):
response = self.client.get(reverse('user_dashboard'))
self.assertRedirects(response, f'{reverse("account_login")}?next={reverse("user_dashboard")}')

def test_login_required_profile(self):
response = self.client.get(reverse('user_profile'))
self.assertRedirects(response, f'{reverse("account_login")}?next={reverse("user_profile")}')

0 comments on commit dc5a5fd

Please sign in to comment.