Skip to content

Commit 352aed6

Browse files
committed
Rebase with latest changes and fix tests
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent b4d2340 commit 352aed6

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

vulnerabilities/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ def create_api_user(self, username, first_name="", last_name="", **extra_fields)
533533
password=None,
534534
first_name=first_name,
535535
last_name=last_name,
536+
**extra_fields,
536537
)
537538

538539
# this ensure that this is not a valid password

vulnerabilities/tests/test_auth.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424

2525
class VulnerableCodeAuthTest(TestCase):
2626
def setUp(self):
27-
self.basic_user = ApiUser.objects.create_api_user(
28-
username="basic_user@foo.com", password=TEST_PASSWORD
29-
)
27+
self.basic_user = ApiUser.objects.create_api_user(username="basic_user@foo.com")
3028

3129
def test_vulnerablecode_auth_api_required_authentication(self):
3230
response = self.client.get(api_package_url)

vulnerabilities/tests/test_throttling.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@
1313
from rest_framework.test import APIClient
1414
from rest_framework.test import APITestCase
1515

16-
User = get_user_model()
16+
from vulnerabilities.models import ApiUser
1717

1818

1919
class ThrottleApiTests(APITestCase):
2020
def setUp(self):
2121
# create a basic user
22-
self.user = User.objects.create_user("username", "e@mail.com", "secret")
22+
self.user = ApiUser.objects.create_api_user(username="e@mail.com")
2323
self.auth = f"Token {self.user.auth_token.key}"
2424
self.csrf_client = APIClient(enforce_csrf_checks=True)
2525
self.csrf_client.credentials(HTTP_AUTHORIZATION=self.auth)
2626

2727
# create a staff user
28-
self.staff_user = User.objects.create_user(
29-
"staff", "staff@mail.com", "secret", is_staff=True
30-
)
28+
self.staff_user = ApiUser.objects.create_api_user(username="staff@mail.com", is_staff=True)
3129
self.staff_auth = f"Token {self.staff_user.auth_token.key}"
3230
self.staff_csrf_client = APIClient(enforce_csrf_checks=True)
3331
self.staff_csrf_client.credentials(HTTP_AUTHORIZATION=self.staff_auth)

0 commit comments

Comments
 (0)