1
0
mirror of https://github.com/google/nomulus synced 2026-02-09 22:40:55 +00:00

Make not logged in errors take precedence over extension errors (#1483)

* Make not logged in errors take precedence over extension errors

This is the right order to do the checks in, because if the registrar isn't
logged in (or their login failed) then they will have an empty set of declared
extensions, so any attempt to use an extension will throw a "Service
extension(s) must be declared at login" error. This is potentially misleading
because the actual error in this situation is that the registrar isn't logged
in at all.

This also fixes some flows that weren't declared final (but should be), or
methods declared final on final classes, which is superfluous.
This commit is contained in:
Ben McIlwain
2021-12-30 17:23:14 -05:00
committed by GitHub
parent 2b38ad8a25
commit 7a174e3ffa
34 changed files with 80 additions and 69 deletions

View File

@@ -130,6 +130,17 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@TestOfyAndSql
void testNotLoggedIn_takesPrecedenceOverUndeclaredExtensions() {
// Attempt to use the fee extension, but there is no login session and no supported extensions.
setEppInput("domain_check_fee_v06.xml", ImmutableMap.of("CURRENCY", "USD"));
sessionMetadata.setRegistrarId(null);
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
// NotLoggedIn should be thrown, not UndeclaredServiceExtensionException.
EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@TestOfyAndSql
void testSuccess_nothingExists() throws Exception {
doCheckTest(