|
99 | 99 | @Config(manifest = Config.NONE)
|
100 | 100 | public class ConfigFetchHandlerTest {
|
101 | 101 | private static final String INSTALLATION_ID = "'fL71_VyL3uo9jNMWu1L60S";
|
102 |
| - private static final String INSTALLATION_TOKEN = |
| 102 | + private static final String INSTALLATION_AUTH_TOKEN = |
103 | 103 | "eyJhbGciOiJF.eyJmaWQiOiJmaXMt.AB2LPV8wRQIhAPs4NvEgA3uhubH";
|
104 | 104 | private static final InstallationTokenResult INSTALLATION_TOKEN_RESULT =
|
105 | 105 | InstallationTokenResult.builder()
|
106 |
| - .setToken(INSTALLATION_TOKEN) |
| 106 | + .setToken(INSTALLATION_AUTH_TOKEN) |
107 | 107 | .setTokenCreationTimestamp(1)
|
108 | 108 | .setTokenExpirationTimestamp(1)
|
109 | 109 | .build();
|
@@ -141,7 +141,7 @@ public void setUp() throws Exception {
|
141 | 141 | new ConfigMetadataClient(context.getSharedPreferences("test_file", Context.MODE_PRIVATE));
|
142 | 142 |
|
143 | 143 | loadBackendApiClient();
|
144 |
| - loadInstanceIdAndToken(); |
| 144 | + loadInstallationIdAndAuthToken(); |
145 | 145 |
|
146 | 146 | /*
|
147 | 147 | * Every fetch starts with a call to retrieve the cached fetch values. Return successfully in
|
@@ -180,32 +180,33 @@ public void fetch_noPreviousSuccessfulFetch_fetchesFromBackend() throws Exceptio
|
180 | 180 | }
|
181 | 181 |
|
182 | 182 | @Test
|
183 |
| - public void fetch_firstFetch_includesIidToken() throws Exception { |
| 183 | + public void fetch_firstFetch_includesInstallationAuthToken() throws Exception { |
184 | 184 | fetchCallToHttpClientReturnsConfigWithCurrentTime(firstFetchedContainer);
|
185 | 185 |
|
186 |
| - assertWithMessage("Fetch() does not include IID token.") |
| 186 | + assertWithMessage("Fetch() does not include installation auth token.") |
187 | 187 | .that(fetchHandler.fetch().isSuccessful())
|
188 | 188 | .isTrue();
|
189 | 189 |
|
190 | 190 | verify(mockBackendFetchApiClient)
|
191 | 191 | .fetch(
|
192 | 192 | any(HttpURLConnection.class),
|
193 | 193 | /* instanceId= */ any(),
|
194 |
| - /* instanceIdToken= */ eq(INSTALLATION_TOKEN), |
| 194 | + /* instanceIdToken= */ eq(INSTALLATION_AUTH_TOKEN), |
195 | 195 | /* analyticsUserProperties= */ any(),
|
196 | 196 | /* lastFetchETag= */ any(),
|
197 | 197 | /* customHeaders= */ any(),
|
198 | 198 | /* currentTime= */ any());
|
199 | 199 | }
|
200 | 200 |
|
201 | 201 | @Test
|
202 |
| - public void fetch_failToGetIidToken_throwsRemoteConfigException() throws Exception { |
| 202 | + public void fetch_failToGetInstallationAuthToken_throwsRemoteConfigException() throws Exception { |
203 | 203 | when(mockFirebaseInstallations.getId())
|
204 | 204 | .thenReturn(Tasks.forException(new IOException("SERVICE_NOT_AVAILABLE")));
|
205 | 205 | fetchCallToHttpClientReturnsConfigWithCurrentTime(firstFetchedContainer);
|
206 | 206 |
|
207 | 207 | assertThrowsClientException(
|
208 |
| - fetchHandler.fetch(), "Failed to get Firebase Installation ID for fetch."); |
| 208 | + fetchHandler.fetch(), |
| 209 | + "Firebase Installations failed to get installation auth token for fetch."); |
209 | 210 |
|
210 | 211 | verifyBackendIsNeverCalled();
|
211 | 212 | }
|
@@ -904,7 +905,7 @@ private void loadETags(String requestETag, String responseETag) {
|
904 | 905 | this.responseETag = responseETag;
|
905 | 906 | }
|
906 | 907 |
|
907 |
| - private void loadInstanceIdAndToken() { |
| 908 | + private void loadInstallationIdAndAuthToken() { |
908 | 909 | when(mockFirebaseInstallations.getId()).thenReturn(Tasks.forResult(INSTALLATION_ID));
|
909 | 910 | when(mockFirebaseInstallations.getToken(false))
|
910 | 911 | .thenReturn(Tasks.forResult(INSTALLATION_TOKEN_RESULT));
|
|
0 commit comments