Fix whitelist tests

Followups to []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121993530
This commit is contained in:
cgoldfeder 2016-05-10 15:16:14 -07:00 committed by Justine Tunney
parent fc936ec2b0
commit d1f34776d2
7 changed files with 109 additions and 15 deletions

View file

@ -1241,21 +1241,30 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(Registry.get("tld").asBuilder()
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
.build());
thrown.expect(RegistrantNotAllowedException.class);
thrown.expect(RegistrantNotAllowedException.class, "jd1234");
runFlow();
}
@Test
public void testFailure_nameserverNotWhitelisted() throws Exception {
persistActiveHost("ns1.example.com");
persistContactsAndHosts();
persistResource(Registry.get("tld").asBuilder()
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.someone.tld"))
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
.build());
thrown.expect(NameserverNotAllowedException.class);
thrown.expect(NameserverNotAllowedException.class, "ns1.example.net");
runFlow();
}
@Test
public void testSuccess_emptyNameserversPassesWhitelist() throws Exception {
setEppInput("domain_create_no_hosts_or_dsdata.xml");
persistResource(Registry.get("tld").asBuilder()
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("somethingelse.example.net"))
.build());
persistContactsAndHosts();
runFlow(); // This is sufficient, as doSuccessfulTests validates hosts, which will fail here.
}
@Test
public void testSuccess_nameserverAndRegistrantWhitelisted() throws Exception {
persistResource(Registry.get("tld").asBuilder()