fix: fixed pylint warnings

This commit is contained in:
Usama Sadiq
2021-10-21 00:47:54 +05:00
committed by Kyle McCormick
parent 470be08a83
commit 95427251dc
16 changed files with 161 additions and 82 deletions

View File

@@ -5,7 +5,6 @@ import copy
from uuid import uuid4
from django.urls import reverse
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.utils.http import urlencode
from rest_framework import status
from rest_framework.test import APITestCase
@@ -69,7 +68,7 @@ class SAMLProviderConfigTests(APITestCase):
slug='edxSideTest',
)
def setUp(self):
def setUp(self): # pylint: disable=super-method-not-called
set_jwt_cookie(self.client, self.user, [(ENTERPRISE_ADMIN_ROLE, ENTERPRISE_ID)])
self.client.force_authenticate(user=self.user)
@@ -147,7 +146,9 @@ class SAMLProviderConfigTests(APITestCase):
assert provider_config.country == SINGLE_PROVIDER_CONFIG_2['country']
# check association has also been created
assert EnterpriseCustomerIdentityProvider.objects.filter(provider_id=convert_saml_slug_provider_id(provider_config.slug)).exists(), 'Cannot find EnterpriseCustomer-->SAMLProviderConfig association'
assert EnterpriseCustomerIdentityProvider.objects.filter(
provider_id=convert_saml_slug_provider_id(provider_config.slug)
).exists(), 'Cannot find EnterpriseCustomer-->SAMLProviderConfig association'
def test_create_one_config_fail_non_existent_enterprise_uuid(self):
"""
@@ -164,7 +165,9 @@ class SAMLProviderConfigTests(APITestCase):
assert SAMLProviderConfig.objects.count() == orig_count
# check association has NOT been created
assert not EnterpriseCustomerIdentityProvider.objects.filter(provider_id=convert_saml_slug_provider_id(SINGLE_PROVIDER_CONFIG_2['slug'])).exists(), 'Did not expect to find EnterpriseCustomer-->SAMLProviderConfig association'
assert not EnterpriseCustomerIdentityProvider.objects.filter(
provider_id=convert_saml_slug_provider_id(SINGLE_PROVIDER_CONFIG_2['slug'])
).exists(), 'Did not expect to find EnterpriseCustomer-->SAMLProviderConfig association'
def test_create_one_config_with_absent_enterprise_uuid(self):
"""

View File

@@ -1,9 +1,9 @@
# pylint: disable=missing-module-docstring
import copy
import pytz
from uuid import uuid4
from datetime import datetime
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.urls import reverse
from django.utils.http import urlencode
from rest_framework import status
@@ -72,7 +72,7 @@ class SAMLProviderDataTests(APITestCase):
enterprise_customer_id=ENTERPRISE_ID
)
def setUp(self):
def setUp(self): # pylint: disable=super-method-not-called
# a cookie with roles: [{enterprise_admin_role: ent_id}] will be
# needed to rbac to authorize access for this view
set_jwt_cookie(self.client, self.user, [(ENTERPRISE_ADMIN_ROLE, ENTERPRISE_ID)])
@@ -102,7 +102,9 @@ class SAMLProviderDataTests(APITestCase):
assert response.status_code == status.HTTP_201_CREATED
assert SAMLProviderData.objects.count() == (orig_count + 1)
assert SAMLProviderData.objects.get(entity_id=SINGLE_PROVIDER_DATA_2['entity_id']).sso_url == SINGLE_PROVIDER_DATA_2['sso_url']
assert SAMLProviderData.objects.get(
entity_id=SINGLE_PROVIDER_DATA_2['entity_id']
).sso_url == SINGLE_PROVIDER_DATA_2['sso_url']
def test_create_one_data_with_absent_enterprise_uuid(self):
"""