mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Re-add assertions that EppExceptions marshal correctly
These checks were removed in [] and re-adding them is the last step of the migration to using expectThrows/assertThrows globally. Note that this is roughly half of them. More to come in a follow-up CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179216707
This commit is contained in:
parent
16a1d6d196
commit
da08baab92
17 changed files with 529 additions and 316 deletions
|
@ -18,7 +18,9 @@ import static google.registry.model.registrar.Registrar.State.ACTIVE;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -63,38 +65,44 @@ public class ValidateLoginCredentialsCommandTest
|
|||
|
||||
@Test
|
||||
public void testFailure_loginWithBadPassword() throws Exception {
|
||||
assertThrows(
|
||||
BadRegistrarPasswordException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
"--client=NewRegistrar",
|
||||
"--password=" + new StringBuilder(PASSWORD).reverse(),
|
||||
"--cert_hash=" + CERT_HASH,
|
||||
"--ip_address=" + CLIENT_IP));
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
BadRegistrarPasswordException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
"--client=NewRegistrar",
|
||||
"--password=" + new StringBuilder(PASSWORD).reverse(),
|
||||
"--cert_hash=" + CERT_HASH,
|
||||
"--ip_address=" + CLIENT_IP));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loginWithBadCertificateHash() throws Exception {
|
||||
assertThrows(
|
||||
EppException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
"--client=NewRegistrar",
|
||||
"--password=" + PASSWORD,
|
||||
"--cert_hash=" + new StringBuilder(CERT_HASH).reverse(),
|
||||
"--ip_address=" + CLIENT_IP));
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
EppException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
"--client=NewRegistrar",
|
||||
"--password=" + PASSWORD,
|
||||
"--cert_hash=" + new StringBuilder(CERT_HASH).reverse(),
|
||||
"--ip_address=" + CLIENT_IP));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loginWithBadIp() throws Exception {
|
||||
assertThrows(
|
||||
EppException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
"--client=NewRegistrar",
|
||||
"--password=" + PASSWORD,
|
||||
"--cert_hash=" + CERT_HASH,
|
||||
"--ip_address=" + new StringBuilder(CLIENT_IP).reverse()));
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
EppException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
"--client=NewRegistrar",
|
||||
"--password=" + PASSWORD,
|
||||
"--cert_hash=" + CERT_HASH,
|
||||
"--ip_address=" + new StringBuilder(CLIENT_IP).reverse()));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue