Migrate VoiceVerificationController to Util#findBestLocale

This commit is contained in:
Chris Eager
2021-03-25 11:53:57 -05:00
committed by Chris Eager
parent deece33a0d
commit 1f53900345
2 changed files with 39 additions and 20 deletions

View File

@@ -5,7 +5,15 @@
package org.whispersystems.textsecuregcm.tests.controllers;
import static org.assertj.core.api.Assertions.assertThat;
import com.google.common.collect.ImmutableSet;
import io.dropwizard.auth.PolymorphicAuthValueFactoryProvider;
import io.dropwizard.testing.FixtureHelpers;
import io.dropwizard.testing.junit.ResourceTestRule;
import java.util.Arrays;
import java.util.HashSet;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
import org.junit.Rule;
import org.junit.Test;
@@ -16,15 +24,6 @@ import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.tests.util.AuthHelper;
import org.whispersystems.textsecuregcm.util.SystemMapper;
import javax.ws.rs.core.Response;
import java.util.Arrays;
import java.util.HashSet;
import io.dropwizard.auth.PolymorphicAuthValueFactoryProvider;
import io.dropwizard.testing.FixtureHelpers;
import io.dropwizard.testing.junit.ResourceTestRule;
import static org.assertj.core.api.Assertions.assertThat;
public class VoiceVerificationControllerTest {
@Rule
@@ -125,7 +124,18 @@ public class VoiceVerificationControllerTest {
.post(null);
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testTwimlMalformedLocale() {
Response response =
resources.getJerseyTest()
.target("/v1/voice/description/123456")
.queryParam("l", "it IT ,")
.request()
.post(null);
assertThat(response.getStatus()).isEqualTo(400);
}
}