Skip to content

Commit df620df

Browse files
committed
Update tests with installations
1 parent 0481a94 commit df620df

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

firebase-config/src/test/java/com/google/firebase/remoteconfig/internal/ConfigFetchHandlerTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@
9999
@Config(manifest = Config.NONE)
100100
public class ConfigFetchHandlerTest {
101101
private static final String INSTALLATION_ID = "'fL71_VyL3uo9jNMWu1L60S";
102-
private static final String INSTALLATION_TOKEN =
102+
private static final String INSTALLATION_AUTH_TOKEN =
103103
"eyJhbGciOiJF.eyJmaWQiOiJmaXMt.AB2LPV8wRQIhAPs4NvEgA3uhubH";
104104
private static final InstallationTokenResult INSTALLATION_TOKEN_RESULT =
105105
InstallationTokenResult.builder()
106-
.setToken(INSTALLATION_TOKEN)
106+
.setToken(INSTALLATION_AUTH_TOKEN)
107107
.setTokenCreationTimestamp(1)
108108
.setTokenExpirationTimestamp(1)
109109
.build();
@@ -141,7 +141,7 @@ public void setUp() throws Exception {
141141
new ConfigMetadataClient(context.getSharedPreferences("test_file", Context.MODE_PRIVATE));
142142

143143
loadBackendApiClient();
144-
loadInstanceIdAndToken();
144+
loadInstallationIdAndAuthToken();
145145

146146
/*
147147
* 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
180180
}
181181

182182
@Test
183-
public void fetch_firstFetch_includesIidToken() throws Exception {
183+
public void fetch_firstFetch_includesInstallationAuthToken() throws Exception {
184184
fetchCallToHttpClientReturnsConfigWithCurrentTime(firstFetchedContainer);
185185

186-
assertWithMessage("Fetch() does not include IID token.")
186+
assertWithMessage("Fetch() does not include installation auth token.")
187187
.that(fetchHandler.fetch().isSuccessful())
188188
.isTrue();
189189

190190
verify(mockBackendFetchApiClient)
191191
.fetch(
192192
any(HttpURLConnection.class),
193193
/* instanceId= */ any(),
194-
/* instanceIdToken= */ eq(INSTALLATION_TOKEN),
194+
/* instanceIdToken= */ eq(INSTALLATION_AUTH_TOKEN),
195195
/* analyticsUserProperties= */ any(),
196196
/* lastFetchETag= */ any(),
197197
/* customHeaders= */ any(),
198198
/* currentTime= */ any());
199199
}
200200

201201
@Test
202-
public void fetch_failToGetIidToken_throwsRemoteConfigException() throws Exception {
202+
public void fetch_failToGetInstallationAuthToken_throwsRemoteConfigException() throws Exception {
203203
when(mockFirebaseInstallations.getId())
204204
.thenReturn(Tasks.forException(new IOException("SERVICE_NOT_AVAILABLE")));
205205
fetchCallToHttpClientReturnsConfigWithCurrentTime(firstFetchedContainer);
206206

207207
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.");
209210

210211
verifyBackendIsNeverCalled();
211212
}
@@ -904,7 +905,7 @@ private void loadETags(String requestETag, String responseETag) {
904905
this.responseETag = responseETag;
905906
}
906907

907-
private void loadInstanceIdAndToken() {
908+
private void loadInstallationIdAndAuthToken() {
908909
when(mockFirebaseInstallations.getId()).thenReturn(Tasks.forResult(INSTALLATION_ID));
909910
when(mockFirebaseInstallations.getToken(false))
910911
.thenReturn(Tasks.forResult(INSTALLATION_TOKEN_RESULT));

0 commit comments

Comments
 (0)