Skip to content

Commit

Permalink
chore: remove developer managed scopes feature flag (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidma415 authored Feb 28, 2024
1 parent 84f17c1 commit 918806d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 84 deletions.
83 changes: 2 additions & 81 deletions cypress/e2e/specs/application_registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,15 +1036,9 @@ describe('Application Registration', () => {
.should('contain', `/application/create?product=${productWithKeyAuthAppAuthStrategy.id}&product_version=${versionWithKeyAuthAuthStrategy.id}&auth_strategy_id=${versionWithKeyAuthAuthStrategy.registration_configs[0].id}`)
})

it('does not show select available scopes if no scopes are available - feature flag on', () => {
it('does not show select available scopes if no scopes are available', () => {
cy.mockProductDocument()
cy.mockProduct()
cy.mockLaunchDarklyFlags([
{
name: 'tdx-3460-developer-managed-scopes',
value: true
}
])
cy.mockProductVersionApplicationRegistration(versions[0])
cy.mockGetProductDocuments(product.id)
cy.mockProductOperations(product.id, versions[0].id)
Expand All @@ -1063,15 +1057,9 @@ describe('Application Registration', () => {
cy.get(`${selectors.appRegModal} [data-testid="register-${apps[0].name}"]`).should('contain', apps[0].name).click()
cy.get('[data-testid="available-scopes-select"]').should('not.exist')
})
it('does show select available scopes if scopes are available - feature flag on', () => {
it('does show select available scopes if scopes are available', () => {
cy.mockProductDocument()
cy.mockProduct(product.id, product)
cy.mockLaunchDarklyFlags([
{
name: 'tdx-3460-developer-managed-scopes',
value: true
}
])
cy.mockProductVersionApplicationRegistration(versions[0])
// Update the version to include registration config
const productVersionWithScopes = versions[0]
Expand Down Expand Up @@ -1103,73 +1091,6 @@ describe('Application Registration', () => {
cy.get(`${selectors.appRegModal} [data-testid="register-${apps[0].name}"]`).should('contain', apps[0].name).click()
cy.get('.available-scopes-select').should('exist')
})
it('does not show select available scopes if scopes are available - feature flag off', () => {
cy.mockProductDocument()
cy.mockProduct(product.id, product)
cy.mockLaunchDarklyFlags([
{
name: 'tdx-3460-developer-managed-scopes',
value: false
}
])
cy.mockProductVersionApplicationRegistration(versions[0])
// Update the version to include registration config
const productVersionWithScopes = versions[0]

productVersionWithScopes.registration_configs = [
{
name: 'openid-connect',
available_scopes: [
'scope1',
'scope2'
]
}
]
cy.mockProductVersion(product.id, versions[0].id, productVersionWithScopes)
cy.mockGetProductDocuments(product.id)
cy.mockProductOperations(product.id, versions[0].id)
cy.mockProductVersionSpec(product.id, versions[0].id)
cy.mockRegistrations('*', []) // mock with empty so that we add one.

cy.viewport(1440, 900)
cy.visit(`/spec/${product.id}`)
cy.get('.swagger-ui', { timeout: 12000 })

cy.mockApplications(apps, 4)
cy.mockProductVersionAvailableRegistrations(product.id, versions[0].id, apps)

cy.get('[data-testid="register-button"]', { timeout: 12000 }).click()
cy.get(selectors.appRegModal).should('exist')
cy.get(`${selectors.appRegModal} [data-testid="register-${apps[0].name}"]`).should('contain', apps[0].name).click()
cy.get('.available-scopes-select').should('not.exist')
})
it('does not show select available scopes if feature flag off', () => {
cy.mockProductDocument()
cy.mockProduct()
cy.mockLaunchDarklyFlags([
{
name: 'tdx-3460-developer-managed-scopes',
value: false
}
])
cy.mockProductVersionApplicationRegistration(versions[0])
cy.mockGetProductDocuments(product.id)
cy.mockProductOperations(product.id, versions[0].id)
cy.mockProductVersionSpec(product.id, versions[0].id)
cy.mockRegistrations('*', []) // mock with empty so that we add one.

cy.viewport(1440, 900)
cy.visit(`/spec/${product.id}`)
cy.get('.swagger-ui', { timeout: 12000 })

cy.mockApplications(apps, 4)
cy.mockProductVersionAvailableRegistrations(product.id, versions[0].id, apps)

cy.get('[data-testid="register-button"]', { timeout: 12000 }).click()
cy.get(selectors.appRegModal).should('exist')
cy.get(`${selectors.appRegModal} [data-testid="register-${apps[0].name}"]`).should('contain', apps[0].name).click()
cy.get('[data-testid="available-scopes-select"]').should('not.exist')
})

it('can request registration to a product and is directed to application upon auto_approval', () => {
cy.mockProductDocument()
Expand Down
3 changes: 1 addition & 2 deletions src/components/ViewSpecRegistrationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export default defineComponent({
const availableScopes = ref([])
const selectedScopes = ref([])
const alreadyGrantedScopes = ref([])
const useDeveloperManagedScopes = useLDFeatureFlag(FeatureFlags.DeveloperManagedScopes, false)
const useAppRegV2 = useLDFeatureFlag(FeatureFlags.AppRegV2, false)
const applications = ref([])
const key = ref(0)
Expand Down Expand Up @@ -376,7 +375,7 @@ export default defineComponent({
})
watch([() => props.product, () => props.version, () => selectedApplication.value], async (newValues, oldValues) => {
if (props.product && props.version && useDeveloperManagedScopes) {
if (props.product && props.version) {
alreadyGrantedScopes.value = []
fetchingScopes.value = true
// Only make the getProductVersion request if we change productVersions
Expand Down
1 change: 0 additions & 1 deletion src/constants/feature-flags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export enum FeatureFlags {
DeveloperManagedScopes = 'tdx-3460-developer-managed-scopes',
AppRegV2 = 'tdx-3531-app-reg-v2'
}

0 comments on commit 918806d

Please sign in to comment.