-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:Flagsmith/flagsmith
- Loading branch information
Showing
46 changed files
with
1,439 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 27 additions & 29 deletions
56
api/e2etests/tests/end_to_end/test_integration_e2e_tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,38 @@ | ||
import os | ||
from unittest import TestCase | ||
|
||
import pytest | ||
from django.urls import reverse | ||
from rest_framework import status | ||
from rest_framework.test import APIClient | ||
|
||
from users.models import FFAdminUser | ||
|
||
|
||
@pytest.mark.django_db | ||
class E2eTestsIntegrationTestCase(TestCase): | ||
def test_e2e_teardown(settings, db): | ||
# TODO: tidy up this hack to fix throttle rates | ||
settings.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"]["signup"] = "1000/min" | ||
token = "test-token" | ||
e2e_user_email = "test@example.com" | ||
register_url = "/api/v1/auth/users/" | ||
|
||
def setUp(self) -> None: | ||
token = "test-token" | ||
self.e2e_user_email = "test@example.com" | ||
os.environ["E2E_TEST_AUTH_TOKEN"] = token | ||
os.environ["FE_E2E_TEST_USER_EMAIL"] = self.e2e_user_email | ||
self.client = APIClient(HTTP_X_E2E_TEST_AUTH_TOKEN=token) | ||
|
||
def test_e2e_teardown(self): | ||
# Register a user with the e2e test user email address | ||
test_password = FFAdminUser.objects.make_random_password() | ||
register_data = { | ||
"email": self.e2e_user_email, | ||
"first_name": "test", | ||
"last_name": "test", | ||
"password": test_password, | ||
"re_password": test_password, | ||
} | ||
register_response = self.client.post(self.register_url, data=register_data) | ||
assert register_response.status_code == status.HTTP_201_CREATED | ||
|
||
# then test that we can teardown that user | ||
url = reverse("api-v1:e2etests:teardown") | ||
teardown_response = self.client.post(url) | ||
assert teardown_response.status_code == status.HTTP_204_NO_CONTENT | ||
assert not FFAdminUser.objects.filter(email=self.e2e_user_email).exists() | ||
os.environ["E2E_TEST_AUTH_TOKEN"] = token | ||
os.environ["FE_E2E_TEST_USER_EMAIL"] = e2e_user_email | ||
|
||
client = APIClient(HTTP_X_E2E_TEST_AUTH_TOKEN=token) | ||
|
||
# Register a user with the e2e test user email address | ||
test_password = FFAdminUser.objects.make_random_password() | ||
register_data = { | ||
"email": os.environ["FE_E2E_TEST_USER_EMAIL"], | ||
"first_name": "test", | ||
"last_name": "test", | ||
"password": test_password, | ||
"re_password": test_password, | ||
} | ||
register_response = client.post(register_url, data=register_data) | ||
assert register_response.status_code == status.HTTP_201_CREATED | ||
|
||
# then test that we can teardown that user | ||
url = reverse("api-v1:e2etests:teardown") | ||
teardown_response = client.post(url) | ||
assert teardown_response.status_code == status.HTTP_204_NO_CONTENT | ||
assert not FFAdminUser.objects.filter(email=e2e_user_email).exists() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.