Skip to content

Commit

Permalink
- reprovisioned storage resource in test account
Browse files Browse the repository at this point in the history
- Moved AuthHelper to AmplifyTestCommon for API and Storage tests
- Adding readme for integration test set up
  • Loading branch information
lawmicha committed Dec 16, 2019
1 parent d31e4cf commit 2ea82d4
Show file tree
Hide file tree
Showing 22 changed files with 815 additions and 685 deletions.
20 changes: 18 additions & 2 deletions Amplify.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
21D79FE12377BF4B0057D00D /* AuthProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D79FE02377BF4B0057D00D /* AuthProvider.swift */; };
21D79FE32377F4120057D00D /* SubscriptionConnectionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D79FE22377F4120057D00D /* SubscriptionConnectionState.swift */; };
21F40A3223A160FC0074678E /* GraphQLDocument+DeleteSyncMutation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3123A160FC0074678E /* GraphQLDocument+DeleteSyncMutation.swift */; };
21F40A3A23A294770074678E /* TestConfigHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3923A294770074678E /* TestConfigHelper.swift */; };
21F40A3C23A2952C0074678E /* AuthHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3B23A2952C0074678E /* AuthHelper.swift */; };
21F40A3E23A295390074678E /* AWSMobileClient+Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3D23A295390074678E /* AWSMobileClient+Message.swift */; };
21F40A4023A295470074678E /* TestCommonConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3F23A295470074678E /* TestCommonConstants.swift */; };
21FFF988230B7B2C005878EA /* AsychronousOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FFF986230B7A5D005878EA /* AsychronousOperation.swift */; };
21FFF98E230C81E6005878EA /* StorageAccessLevel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FFF98D230C81E6005878EA /* StorageAccessLevel.swift */; };
21FFF994230C96CB005878EA /* StorageUploadDataOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FFF98F230C96CA005878EA /* StorageUploadDataOperation.swift */; };
Expand Down Expand Up @@ -584,6 +588,10 @@
21D79FE02377BF4B0057D00D /* AuthProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthProvider.swift; sourceTree = "<group>"; };
21D79FE22377F4120057D00D /* SubscriptionConnectionState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionConnectionState.swift; sourceTree = "<group>"; };
21F40A3123A160FC0074678E /* GraphQLDocument+DeleteSyncMutation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GraphQLDocument+DeleteSyncMutation.swift"; sourceTree = "<group>"; };
21F40A3923A294770074678E /* TestConfigHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestConfigHelper.swift; sourceTree = "<group>"; };
21F40A3B23A2952C0074678E /* AuthHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthHelper.swift; sourceTree = "<group>"; };
21F40A3D23A295390074678E /* AWSMobileClient+Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AWSMobileClient+Message.swift"; sourceTree = "<group>"; };
21F40A3F23A295470074678E /* TestCommonConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestCommonConstants.swift; sourceTree = "<group>"; };
21FFF986230B7A5D005878EA /* AsychronousOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsychronousOperation.swift; sourceTree = "<group>"; };
21FFF98D230C81E6005878EA /* StorageAccessLevel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageAccessLevel.swift; sourceTree = "<group>"; };
21FFF98F230C96CA005878EA /* StorageUploadDataOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageUploadDataOperation.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2028,7 +2036,10 @@
FA9D6C20238DF06B00C7DD9F /* Helpers */ = {
isa = PBXGroup;
children = (
21F40A3B23A2952C0074678E /* AuthHelper.swift */,
21F40A3D23A295390074678E /* AWSMobileClient+Message.swift */,
FA176ED6238503C200C5C5F9 /* HubListenerTestUtilities.swift */,
21F40A3923A294770074678E /* TestConfigHelper.swift */,
);
path = Helpers;
sourceTree = "<group>";
Expand Down Expand Up @@ -2403,11 +2414,12 @@
isa = PBXGroup;
children = (
FACA36062327FBD4000E74F6 /* AmplifyTestCommon.h */,
FACA36072327FBD4000E74F6 /* Info.plist */,
FACF52032329633500646E10 /* TestExtensions.swift */,
FA9D6C20238DF06B00C7DD9F /* Helpers */,
FACA36072327FBD4000E74F6 /* Info.plist */,
FAC23577227A056F00424678 /* Mocks */,
B952182D237E21B900F53237 /* Models */,
21F40A3F23A295470074678E /* TestCommonConstants.swift */,
FACF52032329633500646E10 /* TestExtensions.swift */,
);
path = AmplifyTestCommon;
sourceTree = "<group>";
Expand Down Expand Up @@ -3710,12 +3722,14 @@
B9FAA116238799D3009414B4 /* Author.swift in Sources */,
B9521833237E21BA00F53237 /* Comment+Schema.swift in Sources */,
FA176ED7238503C200C5C5F9 /* HubListenerTestUtilities.swift in Sources */,
21F40A3A23A294770074678E /* TestConfigHelper.swift in Sources */,
B4BD6B3723708C6700A1F0A7 /* MockPredictionsCategoryPlugin.swift in Sources */,
FACA361C2327FC7D000E74F6 /* MockHubCategoryPlugin.swift in Sources */,
FAD3937F23820DAE00463F5E /* MockDataStoreCategoryPlugin.swift in Sources */,
FACA361A2327FC69000E74F6 /* MockStorageCategoryPlugin.swift in Sources */,
B9521837237E21BA00F53237 /* Post.swift in Sources */,
B9FAA11A23879AC8009414B4 /* BookAuthor.swift in Sources */,
21F40A3E23A295390074678E /* AWSMobileClient+Message.swift in Sources */,
FAA2E8BC239FFC7700E420EA /* MockModels.swift in Sources */,
B9FAA11E23879B9F009414B4 /* Book+Schema.swift in Sources */,
FACA361B2327FC74000E74F6 /* MockLoggingCategoryPlugin.swift in Sources */,
Expand All @@ -3731,10 +3745,12 @@
FACA361D2327FC84000E74F6 /* MockAPICategoryPlugin.swift in Sources */,
B9FAA11023878C5E009414B4 /* UserProfile.swift in Sources */,
B9FAA12023879BD0009414B4 /* BookAuthor+Schema.swift in Sources */,
21F40A4023A295470074678E /* TestCommonConstants.swift in Sources */,
B9521835237E21BA00F53237 /* Comment.swift in Sources */,
FACA361E2327FC8E000E74F6 /* MockAnalyticsCategoryPlugin.swift in Sources */,
2129BE012394627B006363A1 /* PostCommentModelRegistration.swift in Sources */,
B9FAA10E23878BF3009414B4 /* UserAccount.swift in Sources */,
21F40A3C23A2952C0074678E /* AuthHelper.swift in Sources */,
FA1846EE23998E44009B9D01 /* MockAPIResponders.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
16 changes: 0 additions & 16 deletions AmplifyPlugins/API/APICategoryPlugin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
21409C5E2384DE2C000A53C9 /* AWSAPIPlugin+GraphQLModelBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C5D2384DE2C000A53C9 /* AWSAPIPlugin+GraphQLModelBehavior.swift */; };
21409C602384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C5F2384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift */; };
21409C7223850BEE000A53C9 /* Todo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7123850BEE000A53C9 /* Todo.swift */; };
21409C7423850BFD000A53C9 /* AWSMobileClient+Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7323850BFD000A53C9 /* AWSMobileClient+Message.swift */; };
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7523850D1D000A53C9 /* BlogPostComment.swift */; };
21409C8123851524000A53C9 /* TestCommonConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C8023851524000A53C9 /* TestCommonConstants.swift */; };
21409C8323851796000A53C9 /* AuthHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C8223851796000A53C9 /* AuthHelper.swift */; };
21598CE2239EE10100529F29 /* TestConfigHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21598CE1239EE10100529F29 /* TestConfigHelper.swift */; };
21598CE3239FF54E00529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */; };
21598CE4239FF61300529F29 /* RESTWithIAMIntegrationTests-awsconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CDE239EDF1000529F29 /* RESTWithIAMIntegrationTests-awsconfiguration.json */; };
21598CF223A0164A00529F29 /* GraphQLWithUserPoolIntegrationTests-amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CF023A0164900529F29 /* GraphQLWithUserPoolIntegrationTests-amplifyconfiguration.json */; };
Expand Down Expand Up @@ -256,13 +252,9 @@
21409C6723850A9E000A53C9 /* AWSAPICategoryPluginTestCommon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AWSAPICategoryPluginTestCommon.framework; sourceTree = BUILT_PRODUCTS_DIR; };
21409C6A23850A9E000A53C9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
21409C7123850BEE000A53C9 /* Todo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Todo.swift; sourceTree = "<group>"; };
21409C7323850BFD000A53C9 /* AWSMobileClient+Message.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AWSMobileClient+Message.swift"; sourceTree = "<group>"; };
21409C7523850D1D000A53C9 /* BlogPostComment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlogPostComment.swift; sourceTree = "<group>"; };
21409C8023851524000A53C9 /* TestCommonConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestCommonConstants.swift; sourceTree = "<group>"; };
21409C8223851796000A53C9 /* AuthHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthHelper.swift; sourceTree = "<group>"; };
21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "RESTWithIAMIntegrationTests-amplifyconfiguration.json"; sourceTree = "<group>"; };
21598CDE239EDF1000529F29 /* RESTWithIAMIntegrationTests-awsconfiguration.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "RESTWithIAMIntegrationTests-awsconfiguration.json"; sourceTree = "<group>"; };
21598CE1239EE10100529F29 /* TestConfigHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestConfigHelper.swift; sourceTree = "<group>"; };
21598CE5239FF8BD00529F29 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
21598CE723A0036600529F29 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
21598CE823A0037800529F29 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
Expand Down Expand Up @@ -543,12 +535,8 @@
21409C6823850A9E000A53C9 /* AWSAPICategoryPluginTestCommon */ = {
isa = PBXGroup;
children = (
21409C8223851796000A53C9 /* AuthHelper.swift */,
21409C7323850BFD000A53C9 /* AWSMobileClient+Message.swift */,
21409C6A23850A9E000A53C9 /* Info.plist */,
21409C7F23850F3D000A53C9 /* Model */,
21409C8023851524000A53C9 /* TestCommonConstants.swift */,
21598CE1239EE10100529F29 /* TestConfigHelper.swift */,
);
path = AWSAPICategoryPluginTestCommon;
sourceTree = "<group>";
Expand Down Expand Up @@ -1948,11 +1936,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
21409C7423850BFD000A53C9 /* AWSMobileClient+Message.swift in Sources */,
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */,
21409C8323851796000A53C9 /* AuthHelper.swift in Sources */,
21598CE2239EE10100529F29 /* TestConfigHelper.swift in Sources */,
21409C8123851524000A53C9 /* TestCommonConstants.swift in Sources */,
21409C7223850BEE000A53C9 /* Todo.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import AWSMobileClient
import AWSAPICategoryPlugin
@testable import Amplify
@testable import AWSAPICategoryPluginTestCommon
@testable import AmplifyTestCommon

// These test cover the more complex scenarios, compared to the Todo graphQL endpoint
class BlogPostCommentGraphQLWithAPIKeyTests: XCTestCase {
Expand Down Expand Up @@ -248,8 +249,8 @@ class BlogPostCommentGraphQLWithAPIKeyTests: XCTestCase {
return blog
}

func createPost(postBlogId: String, title: String) -> Post? {
var post: Post?
func createPost(postBlogId: String, title: String) -> AWSAPICategoryPluginTestCommon.Post? {
var post: AWSAPICategoryPluginTestCommon.Post?
let completeInvoked = expectation(description: "request completed")
let request = GraphQLRequest(apiName: BlogPostCommentGraphQLWithAPIKeyTests.blogPostGraphQLWithAPIKey,
document: CreatePostMutation.document,
Expand Down Expand Up @@ -280,8 +281,8 @@ class BlogPostCommentGraphQLWithAPIKeyTests: XCTestCase {
return post
}

func createComment(commentPostId: String, content: String) -> Comment? {
var comment: Comment?
func createComment(commentPostId: String, content: String) -> AWSAPICategoryPluginTestCommon.Comment? {
var comment: AWSAPICategoryPluginTestCommon.Comment?
let completeInvoked = expectation(description: "request completed")
let request = GraphQLRequest(apiName: BlogPostCommentGraphQLWithAPIKeyTests.blogPostGraphQLWithAPIKey,
document: CreateCommentMutation.document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import XCTest
import AWSMobileClient
import AWSAPICategoryPlugin
@testable import AWSAPICategoryPluginTestCommon
@testable import AmplifyTestCommon

// swiftlint:disable type_body_length
class GraphQLWithUserPoolIntegrationTests: XCTestCase {
Expand Down Expand Up @@ -94,7 +95,7 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase {
/// When: Call mutate API
/// Then: The operation fails with error, user not signed in.
func testCreateTodoMutationWithUserPoolWithoutSignedInUserFailsWithError() {
AWSMobileClient.default().signOut()
AuthHelper.signOut()
let failedInvoked = expectation(description: "request failed")
let expectedId = UUID().uuidString
let expectedName = "testCreateTodoMutationName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import XCTest
@testable import Amplify
import AWSAPICategoryPlugin
import AWSMobileClient
@testable import AWSAPICategoryPluginTestCommon
@testable import AmplifyTestCommon

class RESTWithIAMIntegrationTests: XCTestCase {

Expand Down
Loading

0 comments on commit 2ea82d4

Please sign in to comment.