Skip to content

Commit c8bb1a6

Browse files
authored
chore(all): Remove ignored tests (#2867)
1 parent 6bbb8c4 commit c8bb1a6

File tree

15 files changed

+24
-1528
lines changed

15 files changed

+24
-1528
lines changed

aws-api/src/androidTest/java/com/amplifyframework/api/aws/RestApiInstrumentationTest.java

-51
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@
3131
import org.json.JSONObject;
3232
import org.junit.AfterClass;
3333
import org.junit.BeforeClass;
34-
import org.junit.Ignore;
3534
import org.junit.Test;
3635

37-
import java.util.Collections;
38-
3936
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
4037
import static org.junit.Assert.assertEquals;
41-
import static org.junit.Assert.assertFalse;
4238
import static org.junit.Assert.assertNotNull;
4339
import static org.junit.Assert.assertTrue;
4440

@@ -134,53 +130,6 @@ public void getRequestWithApiKey() throws JSONException, ApiException {
134130
);
135131
}
136132

137-
/**
138-
* Test whether we can make api Rest call in IAM as auth type.
139-
* @throws ApiException On failure to obtain a valid response from API endpoint
140-
*/
141-
@Test
142-
@Ignore("Relies on an AWS account which is no longer active. Resources need to be regenerated.")
143-
public void getRequestWithIAM() throws ApiException {
144-
final RestOptions options = RestOptions.builder()
145-
.addPath("/items")
146-
.addQueryParameters(Collections.singletonMap("key", "value"))
147-
.build();
148-
final RestResponse response = api.get("iamAuthApi", options);
149-
assertNotNull("Should return non-null data", response.getData());
150-
assertTrue("Response should be successful", response.getCode().isSuccessful());
151-
}
152-
153-
/**
154-
* Test whether we can make POST request with empty body and IAM as auth type.
155-
* @throws ApiException On failure to obtain a valid response from API endpoint
156-
*/
157-
@Test
158-
@Ignore("fix in dev-preview")
159-
public void postRequestEmptyBodyWithIAM() throws ApiException {
160-
final RestOptions options = RestOptions.builder()
161-
.addPath("/items")
162-
.addBody("".getBytes())
163-
.build();
164-
final RestResponse response = api.post("iamAuthApi", options);
165-
assertNotNull("Should return non-null data", response.getData());
166-
assertTrue("Response should be successful", response.getCode().isSuccessful());
167-
}
168-
169-
/**
170-
* Test whether we can get failed response for access denied.
171-
* @throws ApiException On failure to obtain a valid response from API endpoint
172-
*/
173-
@Test
174-
@Ignore("Relies on an AWS account which is no longer active. Resources need to be regenerated.")
175-
public void getRequestWithIAMFailedAccess() throws ApiException {
176-
final RestOptions options = RestOptions.builder()
177-
.addPath("/invalidPath")
178-
.build();
179-
final RestResponse response = api.get("iamAuthApi", options);
180-
assertNotNull("Should return non-null data", response.getData());
181-
assertFalse("Response should be unsuccessful", response.getCode().isSuccessful());
182-
}
183-
184133
/**
185134
* Reset all the static fields.
186135
*/

aws-api/src/test/java/com/amplifyframework/api/aws/AWSApiPluginTest.java

-51
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import com.amplifyframework.api.ApiException;
2222
import com.amplifyframework.api.aws.auth.DummyCredentialsProvider;
2323
import com.amplifyframework.api.aws.sigv4.CognitoUserPoolsAuthProvider;
24-
import com.amplifyframework.api.events.ApiChannelEventName;
25-
import com.amplifyframework.api.events.ApiEndpointStatusChangeEvent;
2624
import com.amplifyframework.api.graphql.GraphQLRequest;
2725
import com.amplifyframework.api.graphql.GraphQLResponse;
2826
import com.amplifyframework.api.graphql.PaginatedResult;
@@ -31,11 +29,8 @@
3129
import com.amplifyframework.api.graphql.model.ModelPagination;
3230
import com.amplifyframework.api.graphql.model.ModelQuery;
3331
import com.amplifyframework.core.Consumer;
34-
import com.amplifyframework.hub.HubChannel;
35-
import com.amplifyframework.hub.HubEvent;
3632
import com.amplifyframework.testmodels.commentsblog.BlogOwner;
3733
import com.amplifyframework.testutils.Await;
38-
import com.amplifyframework.testutils.HubAccumulator;
3934
import com.amplifyframework.testutils.Latch;
4035
import com.amplifyframework.testutils.Resources;
4136
import com.amplifyframework.testutils.random.RandomString;
@@ -45,7 +40,6 @@
4540
import org.json.JSONObject;
4641
import org.junit.After;
4742
import org.junit.Before;
48-
import org.junit.Ignore;
4943
import org.junit.Test;
5044
import org.junit.runner.RunWith;
5145
import org.robolectric.RobolectricTestRunner;
@@ -233,51 +227,6 @@ public void graphQlPaginatedQueryRendersExpectedResponse() throws ApiException {
233227
assertNotNull(actualResponse.getData().getRequestForNextResult());
234228
}
235229

236-
/**
237-
* It should be possible to perform a successful call to
238-
* {@link AWSApiPlugin#mutate(GraphQLRequest, Consumer, Consumer)}.
239-
* When the server returns a valid response, then the mutate methods should
240-
* emit content via their value consumer.
241-
* @throws ApiException If call to mutate(...) itself emits such an exception
242-
* @throws JSONException On failure to arrange response JSON
243-
*/
244-
@Test
245-
@Ignore("fix")
246-
public void graphQlMutationGetsResponse() throws JSONException, ApiException {
247-
HubAccumulator networkStatusObserver =
248-
HubAccumulator.create(HubChannel.API, ApiChannelEventName.API_ENDPOINT_STATUS_CHANGED, 1)
249-
.start();
250-
// Arrange a response from the "server"
251-
String expectedName = RandomString.string();
252-
webServer.enqueue(new MockResponse().setBody(new JSONObject()
253-
.put("data", new JSONObject()
254-
.put("createBlogOwner", new JSONObject()
255-
.put("name", expectedName)
256-
)
257-
)
258-
.toString()
259-
));
260-
261-
// Try to perform a mutation.
262-
BlogOwner tony = BlogOwner.builder()
263-
.name(expectedName)
264-
.build();
265-
GraphQLResponse<BlogOwner> actualResponse =
266-
Await.<GraphQLResponse<BlogOwner>, ApiException>result(((onResult, onError) ->
267-
plugin.mutate(ModelMutation.create(tony), onResult, onError)
268-
));
269-
270-
// Assert that the expected response was received
271-
assertEquals(expectedName, actualResponse.getData().getName());
272-
273-
// Verify that the expected hub event fired.
274-
HubEvent<?> event = networkStatusObserver.awaitFirst();
275-
assertNotNull(event);
276-
assertTrue(event.getData() instanceof ApiEndpointStatusChangeEvent);
277-
ApiEndpointStatusChangeEvent eventData = (ApiEndpointStatusChangeEvent) event.getData();
278-
assertEquals(ApiEndpointStatusChangeEvent.ApiEndpointStatus.REACHABLE, eventData.getCurrentStatus());
279-
}
280-
281230
/**
282231
* When the server returns a client error code in response to calling
283232
* {@link AWSApiPlugin#mutate(GraphQLRequest, Consumer, Consumer)}.

aws-auth-cognito/src/androidTest/java/com/amplifyframework/auth/cognito/AuthCanaryTest.kt

-79
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import androidx.test.core.app.ApplicationProvider
2121
import com.amplifyframework.AmplifyException
2222
import com.amplifyframework.api.aws.AWSApiPlugin
2323
import com.amplifyframework.api.rest.RestOptions
24-
import com.amplifyframework.auth.AuthProvider
2524
import com.amplifyframework.auth.AuthUserAttribute
2625
import com.amplifyframework.auth.AuthUserAttributeKey
2726
import com.amplifyframework.auth.cognito.options.AWSCognitoAuthSignInOptions
@@ -44,7 +43,6 @@ import org.junit.Assert.assertTrue
4443
import org.junit.Assert.fail
4544
import org.junit.Before
4645
import org.junit.BeforeClass
47-
import org.junit.Ignore
4846
import org.junit.Test
4947

5048
class AuthCanaryTest {
@@ -137,19 +135,6 @@ class AuthCanaryTest {
137135
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
138136
}
139137

140-
@Test
141-
@Ignore("Sending sign up confirmation code is disabled in the user pool.")
142-
fun resendSignUpCode() {
143-
signUpUser(tempUsername, tempPassword)
144-
val latch = CountDownLatch(1)
145-
Amplify.Auth.resendSignUpCode(
146-
tempUsername,
147-
{ latch.countDown() },
148-
{ fail("Failed to confirm sign up: $it") }
149-
)
150-
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
151-
}
152-
153138
@Test
154139
fun signIn() {
155140
val latch = CountDownLatch(1)
@@ -170,14 +155,6 @@ class AuthCanaryTest {
170155
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
171156
}
172157

173-
@Test
174-
@Ignore("Test will require UI. Implementation is TODO.")
175-
fun signInWithWebUI() { }
176-
177-
@Test
178-
@Ignore("Test will require UI. Implementation is TODO.")
179-
fun signInWithSocialWebUi() { }
180-
181158
// Test requires confirmation code, testing onError call
182159
@Test
183160
fun confirmSignIn() {
@@ -215,7 +192,6 @@ class AuthCanaryTest {
215192
}
216193

217194
@Test
218-
@Ignore("Test fails with missing device key error. Ignoring test pending investigation.")
219195
fun rememberDevice() {
220196
signInUser(username, password)
221197
val latch = CountDownLatch(1)
@@ -227,7 +203,6 @@ class AuthCanaryTest {
227203
}
228204

229205
@Test
230-
@Ignore("Test fails with missing device key error. Ignoring test pending investigation.")
231206
fun forgetDevice() {
232207
signInUser(username, password)
233208
val latch = CountDownLatch(1)
@@ -249,21 +224,6 @@ class AuthCanaryTest {
249224
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
250225
}
251226

252-
@Test
253-
@Ignore("Test requires a temporary user with a confirmed email.")
254-
fun resetPassword() {
255-
signUpUser(tempUsername, tempPassword)
256-
confirmTemporaryUserSignUp(tempUsername)
257-
signInUser(tempUsername, tempPassword)
258-
val latch = CountDownLatch(1)
259-
Amplify.Auth.resetPassword(
260-
tempUsername,
261-
{ latch.countDown() },
262-
{ fail("Reset password failed: $it") }
263-
)
264-
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
265-
}
266-
267227
// Test requires confirmation code, testing onError call
268228
@Test
269229
fun confirmResetPassword() {
@@ -345,19 +305,6 @@ class AuthCanaryTest {
345305
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
346306
}
347307

348-
@Test
349-
@Ignore("Test fails when run too frequently due to resend confirmation code limit exceeded.")
350-
fun resendUserAttributeConfirmationCode() {
351-
signInUser(username, password)
352-
val latch = CountDownLatch(1)
353-
Amplify.Auth.resendUserAttributeConfirmationCode(
354-
AuthUserAttributeKey.email(),
355-
{ latch.countDown() },
356-
{ fail("Failed to resend code: $it") }
357-
)
358-
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
359-
}
360-
361308
@Test
362309
fun getCurrentUser() {
363310
signInUser(username, password)
@@ -438,32 +385,6 @@ class AuthCanaryTest {
438385
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
439386
}
440387

441-
@Test
442-
@Ignore("OAuth flows not set up.")
443-
fun testFederateToIdentityPool() {
444-
signInUser(username, password)
445-
val latch = CountDownLatch(1)
446-
auth.federateToIdentityPool(
447-
"YOUR_TOKEN",
448-
AuthProvider.facebook(),
449-
{ latch.countDown() },
450-
{ fail("Failed to federate to Identity Pool: $it") }
451-
)
452-
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
453-
}
454-
455-
@Test
456-
@Ignore("OAuth flows not set up.")
457-
fun testClearFederateToIdentityPool() {
458-
signInUser(username, password)
459-
val latch = CountDownLatch(1)
460-
auth.clearFederationToIdentityPool(
461-
{ latch.countDown() },
462-
{ fail("Failed to clear federation: $it") }
463-
)
464-
assertTrue(latch.await(TIMEOUT_S, TimeUnit.SECONDS))
465-
}
466-
467388
private fun signUpUser(user: String, pass: String) {
468389
val latch = CountDownLatch(1)
469390
val options = AuthSignUpOptions.builder()

0 commit comments

Comments
 (0)