refactor: CookieMonitoringMiddleware moved to edx-django-utils

The CookieMonitoringMiddleware and its related script
moved to edx-django-utils.

ARCHBOM-2054
This commit is contained in:
Robert Raposa
2022-03-16 21:17:14 -04:00
parent 7a2eee6b21
commit 9fa79809d8
15 changed files with 38 additions and 516 deletions

View File

@@ -27,7 +27,7 @@ from openedx.core.djangoapps.user_api.accounts import ACCOUNT_VISIBILITY_PREF_KE
from openedx.core.djangoapps.user_api.models import UserPreference
from openedx.core.djangoapps.user_api.preferences.api import set_user_preference
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, FilteredQueryCountMixin, skip_unless_lms
from openedx.features.name_affirmation_api.utils import get_name_affirmation_service
from .. import ALL_USERS_VISIBILITY, CUSTOM_VISIBILITY, PRIVATE_VISIBILITY
@@ -195,7 +195,7 @@ class UserAPITestCase(APITestCase):
@ddt.ddt
@skip_unless_lms
class TestOwnUsernameAPI(CacheIsolationTestCase, UserAPITestCase):
class TestOwnUsernameAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITestCase):
"""
Unit tests for the Accounts API.
"""
@@ -253,13 +253,13 @@ class TestOwnUsernameAPI(CacheIsolationTestCase, UserAPITestCase):
{'full': 50, 'small': 10},
clear=True
)
class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITestCase):
"""
Unit tests for the Accounts API.
"""
ENABLED_CACHES = ['default']
TOTAL_QUERY_COUNT = 25
TOTAL_QUERY_COUNT = 24
FULL_RESPONSE_FIELD_COUNT = 30
def setUp(self):
@@ -700,7 +700,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
assert data['accomplishments_shared'] is False
self.client.login(username=self.user.username, password=TEST_PASSWORD)
verify_get_own_information(self._get_num_queries(23))
verify_get_own_information(self._get_num_queries(22))
# Now make sure that the user can get the same information, even if not active
self.user.is_active = False
@@ -720,7 +720,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
legacy_profile.save()
self.client.login(username=self.user.username, password=TEST_PASSWORD)
with self.assertNumQueries(self._get_num_queries(23), table_ignorelist=WAFFLE_TABLES):
with self.assertNumQueries(self._get_num_queries(22), table_ignorelist=WAFFLE_TABLES):
response = self.send_get(self.client)
for empty_field in ("level_of_education", "gender", "country", "state", "bio",):
assert response.data[empty_field] is None