Add the ability to generate RDE deposits in lenient mode

We will not want to run this under normal circumstances, but in cases (such as PDT testing in sandbox) where it's desirable to generate an escrow deposit even if it isn't technically valid XML, this gives us that option. Manual-mode RDE generation is also changed so that, if no watermark date is specified, it defaults to the previous midnight, to better support running of RDE in sandbox to catch data problems.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156108295
This commit is contained in:
mountford 2017-05-15 14:56:02 -07:00 committed by Ben McIlwain
parent e1f4df86bd
commit 74a0defef3
9 changed files with 101 additions and 33 deletions

View file

@ -15,6 +15,7 @@
package google.registry.rde;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.xml.ValidationMode.STRICT;
import google.registry.model.registrar.Registrar;
import google.registry.testing.AppEngineRule;
@ -40,7 +41,8 @@ public class RdeMarshallerTest extends ShardableTestCase {
@Test
public void testMarshalRegistrar_validData_producesXmlFragment() throws Exception {
DepositFragment fragment =
new RdeMarshaller().marshalRegistrar(Registrar.loadByClientId("TheRegistrar"));
new RdeMarshaller(STRICT)
.marshalRegistrar(Registrar.loadByClientId("TheRegistrar"));
assertThat(fragment.type()).isEqualTo(RdeResourceType.REGISTRAR);
assertThat(fragment.error()).isEmpty();
String expected = ""
@ -83,7 +85,8 @@ public class RdeMarshallerTest extends ShardableTestCase {
@Test
public void testMarshalRegistrar_unicodeCharacters_dontGetMangled() throws Exception {
DepositFragment fragment =
new RdeMarshaller().marshalRegistrar(Registrar.loadByClientId("TheRegistrar"));
new RdeMarshaller(STRICT)
.marshalRegistrar(Registrar.loadByClientId("TheRegistrar"));
assertThat(fragment.xml()).contains("123 Example Bőulevard");
}
}