-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add field auth e2e userpools provider #2156
Merged
phani-srikar
merged 6 commits into
feature/sql-field-auth-support
from
add-field-auth-e2e-private
Jan 2, 2024
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e1154da
test: add userpool private field auth tests
phani-srikar 725e22f
chore: move field tests to new test file
phani-srikar 93632cc
chore: unset testingWithLatestCodebase
phani-srikar 4047fd4
test: add owner and list of owners e2es userpool
phani-srikar a70a35b
chore: update unit test for sql field auth support
phani-srikar 9afa99d
chore: minor refactors to test utils, add todos for commented out sni…
phani-srikar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
packages/amplify-e2e-tests/src/__tests__/auth-test-schemas/userpool-provider-fields.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { ImportedRDSType } from '@aws-amplify/graphql-transformer-core'; | ||
import { convertToDBSpecificGraphQLString, generateDDL } from '../../rds-v2-test-utils'; | ||
|
||
export const schema = (engine: ImportedRDSType): string => ` | ||
type TodoPrivateContentVarious @model @auth(rules: [{ allow: private }]) { | ||
id: ID! @primaryKey @auth(rules: [{ allow: private }, { allow: public }]) | ||
owner: String | ||
authors: [String] | ||
privateContent: String @auth(rules: [{ allow: private }]) | ||
publicContent: String @auth(rules: [{ allow: public }]) | ||
ownerContent: String @auth(rules: [{ allow: owner, operations: [create, read] }]) | ||
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors", operations: [update, read] }]) | ||
} | ||
|
||
type TodoOwnerContentVarious @model @auth(rules: [{ allow: owner }]) { | ||
id: ID! @primaryKey @auth(rules: [{ allow: owner }, { allow: private }, { allow: public }]) | ||
owner: String | ||
authors: [String] | ||
privateContent: String @auth(rules: [{ allow: private, operations: [create, update, read] }]) | ||
publicContent: String @auth(rules: [{ allow: public }]) | ||
ownerContent: String @auth(rules: [{ allow: owner, operations: [update, delete, read] }]) | ||
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors", operations: [create, read] }]) | ||
} | ||
|
||
type TodoCustomOwnerContentVarious @model @auth(rules: [{ allow: owner, ownerField: "author" }]) { | ||
customId: ID! @primaryKey @auth(rules: [{ allow: owner, ownerField: "author" }, { allow: private }, { allow: public }]) | ||
author: String | ||
privateContent: String @auth(rules: [{ allow: private }, { allow: owner, ownerField: "author", operations: [delete] }]) | ||
publicContent: String @auth(rules: [{ allow: public }, { allow: owner, ownerField: "author", operations: [delete] }]) | ||
ownerContent: String @auth(rules: [{ allow: owner, ownerField: "author", operations: [create, delete, read] }]) | ||
} | ||
|
||
type TodoCustomOwnersContentVarious @model @auth(rules: [{ allow: owner, ownerField: "authors" }]) { | ||
customId: ID! @primaryKey @auth(rules: [{ allow: owner, ownerField: "authors" }, { allow: private }, { allow: public }]) | ||
authors: [String] | ||
privateContent: String @auth(rules: [{ allow: private }]) | ||
publicContent: String @auth(rules: [{ allow: public }]) | ||
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors", operations: [update, read] }]) | ||
} | ||
|
||
type TodoAdminContentVarious @model @auth(rules: [{ allow: groups, groups: ["Admin"] }]) { | ||
id: ID! @primaryKey @auth(rules: [{ allow: groups, groups: ["Admin"] }, { allow: private }, { allow: public }]) | ||
owner: String | ||
authors: [String] | ||
privateContent: String @auth(rules: [{ allow: private }]) | ||
publicContent: String @auth(rules: [{ allow: public }]) | ||
ownerContent: String @auth(rules: [{ allow: owner }]) | ||
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors" }]) | ||
} | ||
|
||
type TodoCustomGroupContentVarious @model @auth(rules: [{ allow: groups, groupsField: "customGroup" }]) { | ||
customId: ID! @primaryKey @auth(rules: [{ allow: groups, groupsField: "customGroup" }, { allow: private }, { allow: public }]) | ||
owner: String | ||
authors: [String] | ||
customGroup: String | ||
privateContent: String @auth(rules: [{ allow: private }]) | ||
publicContent: String @auth(rules: [{ allow: public }]) | ||
ownerContent: String @auth(rules: [{ allow: owner }]) | ||
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors" }]) | ||
adminContent: String @auth(rules: [{ allow: groups, groups: ["Admin"] }]) | ||
} | ||
|
||
type TodoCustomGroupsContentVarious @model @auth(rules: [{ allow: groups, groupsField: "customGroups" }]) { | ||
customId: ID! @primaryKey @auth(rules: [{ allow: groups, groupsField: "customGroups" }, { allow: private }, { allow: public }]) | ||
owner: String | ||
authors: [String] | ||
customGroups: [String] | ||
privateContent: String @auth(rules: [{ allow: private }]) | ||
publicContent: String @auth(rules: [{ allow: public }]) | ||
ownerContent: String @auth(rules: [{ allow: owner }]) | ||
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors" }]) | ||
adminContent: String @auth(rules: [{ allow: groups, groups: ["Admin"] }]) | ||
} | ||
`; | ||
|
||
export const sqlCreateStatements = (engine: ImportedRDSType): string[] => generateDDL(schema(engine), engine); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is
engine
used?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's certainly is not used here, removed.