mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 03:57:51 +02:00
Add generic XML syntax testing to a flow test
Adding it to one test is sufficient because we use the same loading logic across all flows. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=239506003
This commit is contained in:
parent
36fd13f8e0
commit
2a18e705a2
5 changed files with 26 additions and 13 deletions
|
@ -785,6 +785,8 @@ A flow for an Epp "hello".
|
|||
|
||||
### Errors
|
||||
|
||||
* 2001
|
||||
* Generic XML syntax error that can be thrown by any flow.
|
||||
|
||||
## HostCheckFlow
|
||||
|
||||
|
|
|
@ -22,7 +22,11 @@ import google.registry.model.eppoutput.Greeting;
|
|||
import google.registry.util.Clock;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** A flow for an Epp "hello". */
|
||||
/**
|
||||
* A flow for an Epp "hello".
|
||||
*
|
||||
* @error {@link google.registry.flows.FlowUtils.GenericXmlSyntaxErrorException}
|
||||
*/
|
||||
public class HelloFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
|
|
|
@ -226,13 +226,6 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
assertPollMessagesHelper(getPollMessages(clientId), expected);
|
||||
}
|
||||
|
||||
public void assertPollMessages(
|
||||
String clientId,
|
||||
DateTime now,
|
||||
PollMessage... expected) {
|
||||
assertPollMessagesHelper(getPollMessages(clientId, now), expected);
|
||||
}
|
||||
|
||||
public void assertPollMessages(PollMessage... expected) {
|
||||
assertPollMessagesHelper(getPollMessages(), expected);
|
||||
}
|
||||
|
@ -326,10 +319,6 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
|
||||
private TmchCaMode tmchCaMode = TmchCaMode.PILOT;
|
||||
|
||||
protected void useTmchProdCert() {
|
||||
tmchCaMode = TmchCaMode.PRODUCTION;
|
||||
}
|
||||
|
||||
public EppOutput dryRunFlowAssertResponse(String xml, String... ignoredPaths) throws Exception {
|
||||
List<Object> beforeEntities = ofy().load().list();
|
||||
EppOutput output =
|
||||
|
|
|
@ -14,10 +14,14 @@
|
|||
|
||||
package google.registry.flows.session;
|
||||
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.time.format.ISODateTimeFormat.dateTimeNoMillis;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowTestCase;
|
||||
import google.registry.flows.FlowUtils.GenericXmlSyntaxErrorException;
|
||||
import org.junit.Test;
|
||||
|
||||
/** Unit tests for {@link HelloFlow}. */
|
||||
|
@ -31,4 +35,13 @@ public class HelloFlowTest extends FlowTestCase<HelloFlow> {
|
|||
loadFile(
|
||||
"greeting.xml", ImmutableMap.of("DATE", clock.nowUtc().toString(dateTimeNoMillis()))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenericSyntaxException() {
|
||||
// This is a generic syntax test--we don't have a generic flow test case so this simple
|
||||
// test class will do. Note: the logic this tests is common to all flows.
|
||||
setEppInput("generic_syntax_exception.xml");
|
||||
EppException thrown = assertThrows(GenericXmlSyntaxErrorException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
}
|
||||
|
|
5
javatests/google/registry/flows/session/testdata/generic_syntax_exception.xml
vendored
Normal file
5
javatests/google/registry/flows/session/testdata/generic_syntax_exception.xml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
this is some bad XML
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Reference in a new issue