Test UnknownCurrencyEppException in the flow tests

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=239279335
This commit is contained in:
gbrodman 2019-03-19 15:12:56 -07:00 committed by Ben McIlwain
parent dbe8b9f8c6
commit 6e01d400cd
21 changed files with 119 additions and 111 deletions

View file

@ -31,6 +31,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.flows.EppException;
import google.registry.flows.FlowUtils.UnknownCurrencyEppException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
@ -556,7 +557,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
*/
@Test
public void testFeeExtension_createCommand() throws Exception {
setEppInput("domain_info_fee_create.xml");
setEppInput("domain_info_fee_create.xml", ImmutableMap.of("CURRENCY", "USD"));
persistTestEntities(false);
doSuccessfulTest("domain_info_fee_create_response.xml", false);
}
@ -624,12 +625,19 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
/** Test setting the currency explicitly to a wrong value. */
@Test
public void testFeeExtension_wrongCurrency() {
setEppInput("domain_info_fee_create_euro.xml");
setEppInput("domain_info_fee_create.xml", ImmutableMap.of("CURRENCY", "EUR"));
persistTestEntities(false);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_unknownCurrency() {
setEppInput("domain_info_fee_create.xml", ImmutableMap.of("CURRENCY", "BAD"));
EppException thrown = assertThrows(UnknownCurrencyEppException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
/** Test requesting a period that isn't in years. */
@Test
public void testFeeExtension_periodNotInYears() {