From 8ee4a7d8e42d84a5812d13027f1b747a2c1586f7 Mon Sep 17 00:00:00 2001 From: Kelvin Muchiri Date: Tue, 16 Apr 2024 14:49:45 +0300 Subject: [PATCH] add attributes login_username, login_password to TestAbstractViewSet --- onadata/apps/api/tests/viewsets/test_abstract_viewset.py | 2 ++ onadata/apps/api/tests/viewsets/test_briefcase_viewset.py | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/onadata/apps/api/tests/viewsets/test_abstract_viewset.py b/onadata/apps/api/tests/viewsets/test_abstract_viewset.py index a3f144683b..4164a29f77 100644 --- a/onadata/apps/api/tests/viewsets/test_abstract_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_abstract_viewset.py @@ -189,6 +189,8 @@ def _login_user_and_profile(self, extra_post_data=None): ) ) self.extra = {"HTTP_AUTHORIZATION": f"Token {self.user.auth_token}"} + self.login_username = self.profile_data["username"] + self.login_password = self.profile_data["password1"] def _org_create(self, org_data=None): org_data = {} if org_data is None else org_data diff --git a/onadata/apps/api/tests/viewsets/test_briefcase_viewset.py b/onadata/apps/api/tests/viewsets/test_briefcase_viewset.py index 67804088aa..1b91199eba 100644 --- a/onadata/apps/api/tests/viewsets/test_briefcase_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_briefcase_viewset.py @@ -14,7 +14,6 @@ from django.utils import timezone from django_digest.test import DigestAuth -from rest_framework.test import APIRequestFactory from onadata.apps.api.tests.viewsets.test_abstract_viewset import TestAbstractViewSet from onadata.apps.api.viewsets.briefcase_viewset import ( @@ -41,9 +40,6 @@ class TestBriefcaseViewSet(TestAbstractViewSet): def setUp(self): super().setUp() - self.factory = APIRequestFactory() - self.login_username = "bob" - self.login_password = "bobbob" self.form_def_path = os.path.join( self.main_directory, "fixtures", "transportation", "transportation.xml" )