Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
Reorder steps to clear cache
Acho Arnold48f23e4fcfcf
diff --git a/tests/helpers_test.go b/tests/helpers_test.goindex 41c20e35..6b4a0782 100644--- a/tests/helpers_test.go+++ b/tests/helpers_test.go@@ -78,7 +78,18 @@ func setupPhone(ctx context.Context, t *testing.T, messagesPerMinute uint) testPfcmToken := "fcm-" + uuid.New().String()client := newAPIClient()- _, resp, err := client.Phones.Upsert(ctx, &httpsms.PhoneUpsertParams{+ // Create the phone API key first so that a few seconds pass (during phone upsert)+ // before we use it, giving the cache time to clear.+ apiKeyResp, resp, err := client.PhoneAPIKeys.Store(ctx, &httpsms.PhoneAPIKeyStoreParams{+ Name: "test-key-" + uuid.New().String(),+ })+ require.NoError(t, err)+ require.Equal(t, http.StatusOK, resp.HTTPResponse.StatusCode, "phone api key store failed")++ phoneAPIKeyValue := apiKeyResp.Data.APIKey+ require.NotEmpty(t, phoneAPIKeyValue)++ _, resp, err = client.Phones.Upsert(ctx, &httpsms.PhoneUpsertParams{PhoneNumber: phoneNumber,FcmToken: fcmToken,MessagesPerMinute: messagesPerMinute,@@ -89,15 +100,6 @@ func setupPhone(ctx context.Context, t *testing.T, messagesPerMinute uint) testPrequire.NoError(t, err)require.Equal(t, http.StatusOK, resp.HTTPResponse.StatusCode, "phone upsert failed")- apiKeyResp, resp, err := client.PhoneAPIKeys.Store(ctx, &httpsms.PhoneAPIKeyStoreParams{- Name: "test-key-" + uuid.New().String(),- })- require.NoError(t, err)- require.Equal(t, http.StatusOK, resp.HTTPResponse.StatusCode, "phone api key store failed")-- phoneAPIKeyValue := apiKeyResp.Data.APIKey- require.NotEmpty(t, phoneAPIKeyValue)-phoneClient := newPhoneClient(phoneAPIKeyValue)_, resp, err = phoneClient.Phones.UpsertFCMToken(ctx, &httpsms.PhoneFCMTokenParams{PhoneNumber: phoneNumber,