Merge pull request #17911 from edx/bexline/tpa_model_cleanup

ENT-943 Cleanup of old third_party_auth provider slug fields
This commit is contained in:
Brittney Exline
2018-04-11 10:56:07 -06:00
committed by GitHub
9 changed files with 23 additions and 25 deletions

View File

@@ -152,7 +152,6 @@ class TestSAMLCommand(TestCase):
saml_provider_config={
"site__domain": "second.testserver.fake",
"site__name": "testserver.fake",
"idp_slug": "second-test-shib",
"slug": "second-test-shib",
"entity_id": "https://idp.testshib.org/idp/another-shibboleth",
"metadata_source": "https://www.testshib.org/metadata/another-testshib-providers.xml",
@@ -168,7 +167,6 @@ class TestSAMLCommand(TestCase):
saml_provider_config={
"site__domain": "third.testserver.fake",
"site__name": "testserver.fake",
"idp_slug": "third-test-shib",
"slug": "third-test-shib",
# Note: This entity id will not be present in returned response and will cause failed update.
"entity_id": "https://idp.testshib.org/idp/non-existent-shibboleth",
@@ -190,7 +188,6 @@ class TestSAMLCommand(TestCase):
saml_provider_config={
"site__domain": "fourth.testserver.fake",
"site__name": "testserver.fake",
"idp_slug": "fourth-test-shib",
"slug": "fourth-test-shib",
"automatic_refresh_enabled": False,
# Note: This invalid entity id will not be present in the refresh set
@@ -245,7 +242,6 @@ class TestSAMLCommand(TestCase):
},
saml_provider_config={
"site__domain": "third.testserver.fake",
"idp_slug": "third-test-shib",
"slug": "third-test-shib",
# Note: This entity id will not be present in returned response and will cause failed update.
"entity_id": "https://idp.testshib.org/idp/non-existent-shibboleth",

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-10 13:57
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('third_party_auth', '0019_consolidate_slug'),
]
operations = [
migrations.RemoveField(
model_name='oauth2providerconfig',
name='provider_slug',
),
migrations.RemoveField(
model_name='samlproviderconfig',
name='idp_slug',
),
]

View File

@@ -328,12 +328,6 @@ class OAuth2ProviderConfig(ProviderConfig):
# To be precise, it's set by AUTHENTICATION_BACKENDS - which aws.py sets from THIRD_PARTY_AUTH_BACKENDS
)
)
provider_slug = models.SlugField(
max_length=30, db_index=True,
help_text=(
'A short string uniquely identifying this provider. '
'Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"'
))
key = models.TextField(blank=True, verbose_name="Client ID")
secret = models.TextField(
blank=True,
@@ -524,12 +518,6 @@ class SAMLProviderConfig(ProviderConfig):
backend_name = models.CharField(
max_length=50, default='tpa-saml', blank=False,
help_text="Which python-social-auth provider backend to use. 'tpa-saml' is the standard edX SAML backend.")
idp_slug = models.SlugField(
max_length=30, db_index=True,
help_text=(
'A short string uniquely identifying this provider. '
'Cannot contain spaces and should be a usable as a CSS class. Examples: "ubc", "mit-staging"'
))
entity_id = models.CharField(
max_length=255, verbose_name="Entity ID", help_text="Example: https://idp.testshib.org/idp/shibboleth")
metadata_source = models.CharField(

View File

@@ -30,7 +30,6 @@ class SAMLProviderConfigFactory(DjangoModelFactory):
site = SubFactory(SiteFactory)
enabled = True
idp_slug = "test-shib"
slug = "test-shib"
name = "TestShib College"

View File

@@ -91,7 +91,6 @@ class SamlIntegrationTestUtilities(object):
kwargs.setdefault('name', self.PROVIDER_NAME)
kwargs.setdefault('enabled', True)
kwargs.setdefault('visible', True)
kwargs.setdefault('idp_slug', self.PROVIDER_IDP_SLUG)
kwargs.setdefault('slug', self.PROVIDER_IDP_SLUG)
kwargs.setdefault('entity_id', TESTSHIB_ENTITY_ID)
kwargs.setdefault('metadata_source', TESTSHIB_METADATA_URL)
@@ -200,7 +199,6 @@ class TestShibIntegrationTest(SamlIntegrationTestUtilities, IntegrationTestMixin
kwargs.setdefault('name', self.PROVIDER_NAME)
kwargs.setdefault('enabled', True)
kwargs.setdefault('visible', True)
kwargs.setdefault('idp_slug', self.PROVIDER_IDP_SLUG)
kwargs.setdefault('slug', self.PROVIDER_IDP_SLUG)
kwargs.setdefault('entity_id', TESTSHIB_ENTITY_ID)
kwargs.setdefault('metadata_source', TESTSHIB_METADATA_URL_WITH_CACHE_DURATION)

View File

@@ -58,7 +58,6 @@ class RegistryTest(testutil.TestCase):
self.configure_saml_provider(
enabled=True,
name="Disallowed",
idp_slug="test",
slug="test",
backend_name="disallowed"
)

View File

@@ -78,7 +78,6 @@ class ThirdPartyAuthTestMixin(object):
@staticmethod
def configure_oauth_provider(**kwargs):
""" Update the settings for an OAuth2-based third party auth provider """
kwargs.setdefault('provider_slug', kwargs['backend_name'])
kwargs.setdefault('slug', kwargs['backend_name'])
obj = OAuth2ProviderConfig(**kwargs)
obj.save()

View File

@@ -10,7 +10,6 @@
"icon_class": "fa-google-plus",
"icon_image": null,
"backend_name": "google-oauth2",
"provider_slug": "google-oauth2",
"slug": "google-oauth2",
"key": "test",
"secret": "test",
@@ -30,7 +29,6 @@
"icon_class": "fa-facebook",
"icon_image": null,
"backend_name": "facebook",
"provider_slug": "facebook",
"slug": "facebook",
"key": "test",
"secret": "test",
@@ -50,7 +48,6 @@
"icon_class": "",
"icon_image": "test-icon.png",
"backend_name": "dummy",
"provider_slug": "dummy",
"slug": "dummy",
"key": "",
"secret": "",

View File

@@ -499,7 +499,6 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
kwargs.setdefault('name', provider_name)
kwargs.setdefault('enabled', True)
kwargs.setdefault('visible', True)
kwargs.setdefault('idp_slug', idp_slug)
kwargs.setdefault('slug', idp_slug)
kwargs.setdefault('entity_id', 'https://idp.testshib.org/idp/shibboleth')
kwargs.setdefault('metadata_source', 'https://mock.testshib.org/metadata/testshib-providers.xml')