Skip to content

Commit

Permalink
test: rm e2e test changes and move to aws-amplify#10198
Browse files Browse the repository at this point in the history
  • Loading branch information
danielleadams committed Apr 21, 2022
1 parent 5965a06 commit 156538a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ $util.unauthorized()
#if( $util.authType() == \\"User Pool Authorization\\" )
#if( !$isAuthorized )
#set( $ownerEntity0 = $util.defaultIfNull($ctx.args.input.owner, null) )
#set( $ownerClaim0 = $ctx.identity.claims.get(\\"sub\\") )
#set( $currentClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) )
#set( $ownerClaim0 = \\"$ownerClaim0:$currentClaim0\\" )
#set( $ownerClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) )
#set( $ownerAllowedFields0 = [\\"id\\",\\"content\\"] )
#set( $isAuthorizedOnAllFields0 = true )
#if( $ownerClaim0 == $ownerEntity0 )
Expand Down Expand Up @@ -65,9 +63,7 @@ $util.unauthorized()
#if( $util.authType() == \\"User Pool Authorization\\" )
#if( !$isAuthorized )
#set( $ownerEntity0 = $util.defaultIfNull($ctx.args.input.owner, null) )
#set( $ownerClaim0 = $ctx.identity.claims.get(\\"sub\\") )
#set( $currentClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) )
#set( $ownerClaim0 = \\"$ownerClaim0:$currentClaim0\\" )
#set( $ownerClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) )
#set( $ownerAllowedFields0 = [\\"id\\",\\"content\\"] )
#set( $isAuthorizedOnAllFields0 = true )
#if( $ownerClaim0 == $ownerEntity0 )
Expand Down
34 changes: 0 additions & 34 deletions packages/amplify-e2e-tests/src/__tests__/api_2.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { JSONUtilities } from 'amplify-cli-core';
import {
addApi,
Expand All @@ -21,7 +20,6 @@ import {
updateApiSchema,
updateAPIWithResolutionStrategyWithModels,
setCustomRolesConfig,
addFeatureFlag,
} from 'amplify-e2e-core';
import AWSAppSyncClient, { AUTH_TYPE } from 'aws-appsync';
import { existsSync, readFileSync } from 'fs';
Expand Down Expand Up @@ -309,36 +307,6 @@ describe('amplify add api (GraphQL)', () => {
expect(beforeAdminConfig).not.toEqual(afterAdminConfig);
});

it('init a project and add custom iam roles - local test with gql v2 w/ identity claim feature flag disabled', async () => {
const name = 'customadminroles';
await initJSProjectWithProfile(projRoot, { name });
addFeatureFlag(projRoot, 'graphqlTransformer', 'userSubUsernameForDefaultIdentityClaim', false);
await addApi(projRoot, { transformerVersion: 2, IAM: {}, 'Amazon Cognito User Pool': {} });
updateApiSchema(projRoot, name, 'cognito_simple_model.graphql');
await apiGqlCompile(projRoot);
const createResolver = path.join(
projRoot,
'amplify',
'backend',
'api',
name,
'build',
'resolvers',
'Mutation.createTodo.auth.1.req.vtl',
);
const beforeAdminConfig = readFileSync(createResolver).toString();
expect(beforeAdminConfig).toMatchSnapshot();

const customRolesConfig = {
adminRoleNames: ['myAdminRoleName'],
};
setCustomRolesConfig(projRoot, name, customRolesConfig);
await apiGqlCompile(projRoot);
const afterAdminConfig = readFileSync(createResolver).toString();
expect(afterAdminConfig).toMatchSnapshot();
expect(beforeAdminConfig).not.toEqual(afterAdminConfig);
});

// TODO: Disabling for now until further conversation.
// it('inits a project with a simple model with deletion protection enabled and then migrates the api', async () => {
// const projectName = 'retaintables';
Expand Down Expand Up @@ -369,5 +337,3 @@ describe('amplify add api (GraphQL)', () => {
// }
// });
});

/* eslint-enable */

0 comments on commit 156538a

Please sign in to comment.