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

@ -1181,18 +1181,17 @@ public class DomainApplicationCreateFlowTest
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();
}
@ -1209,6 +1208,20 @@ public class DomainApplicationCreateFlowTest
.hasApplicationStatus(ApplicationStatus.VALIDATED);
}
@Test
public void testSuccess_emptyNameserversPassesWhitelist() throws Exception {
setEppInput("domain_create_sunrise_encoded_signed_mark_no_hosts.xml");
persistResource(Registry.get("tld").asBuilder()
.setAllowedRegistrantContactIds(ImmutableSet.of("jd1234"))
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("somethingelse.example.net"))
.build());
persistContactsAndHosts();
clock.advanceOneMilli();
doSuccessfulTest("domain_create_sunrise_encoded_signed_mark_response.xml", true);
assertAboutApplications().that(getOnlyGlobalResource(DomainApplication.class))
.hasApplicationStatus(ApplicationStatus.VALIDATED);
}
/**
* There is special logic that disallows a failfast for domains in add grace period and sunrush
* add grace period, so make sure that they fail anyways in the actual flow.