Erweiterung der Tests um das Ändern von den neuen Domain Eigenschaften, z.B. PassengerPython

This commit is contained in:
Timotheus Pokorra 2023-12-12 11:52:39 +01:00
parent 643b23ad34
commit 9a6a6d094a

View File

@ -135,6 +135,13 @@ public class DomainTest {
Map<?, ?> row = (Map<?, ?>) o;
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
assertTrue("ValidSubdomainNames should be * but is " + row.get("validsubdomainnames"), "*".equals(row.get("validsubdomainnames")));
String defaultPassengerPython = "";
assertTrue("PassengerPython should be empty but is " + row.get("passengerpython"), isNullOrEmpty(row.get("passengerpython")));
assertTrue("PassengerNodejs should be empty but is " + row.get("passengernodejs"), isNullOrEmpty(row.get("passengernodejs")));
assertTrue("PassengerRuby should be empty but is " + row.get("passengerruby"), isNullOrEmpty(row.get("passengerruby")));
assertTrue("FcgiPhpBin should be empty but is " + row.get("fcgiphpbin"), isNullOrEmpty(row.get("fcgiphpbin")));
String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
String[] expectedDomainOptions = new String[] {"htdocsfallback", "indexes", "dkim", "autoconfig", "greylisting", "includes", "letsencrypt", "multiviews"};
Arrays.sort(expectedDomainOptions);
@ -156,10 +163,21 @@ public class DomainTest {
// now update the domain
setParams = new HashMap<String, Object>();
whereParams = new HashMap<String, String>();
setParams.put("validsubdomainnames", "www2");
String newPassengerPython = "/home/pacs/aaa00/users/admin/.venv/bin/python3";
setParams.put("passengerpython", newPassengerPython);
String newPassengerRuby = "/home/pacs/aaa00/users/admin/.rbenv/shims/ruby";
setParams.put("passengerruby", newPassengerRuby);
String newPassengerNodejs = "/home/pacs/aaa00/users/admin/.nvm/versions/node/v18.19.0/bin/node";
setParams.put("passengernodejs", newPassengerNodejs);
String newFcgiPhpBin = "/usr/bin/php8.1";
setParams.put("fcgiphpbin", newFcgiPhpBin);
String[] newDomainOptions = new String[] {"greylisting", "letsencrypt", "passenger", "passengerfriendlyerrorpages", "cgi", "fastcgi"};
setParams.put("domainoptions", newDomainOptions);
whereParams = new HashMap<String, String>();
whereParams.put("name", "exampleupdate.de");
params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
@ -174,6 +192,12 @@ public class DomainTest {
Map<?, ?> row = (Map<?, ?>) o;
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
assertTrue("ValidSubdomainNames should be www2 but is " + row.get("validsubdomainnames"), "www2".equals(row.get("validsubdomainnames")));
assertTrue("PassengerPython should be " + newPassengerPython + " but is " + row.get("passengerpython"), newPassengerPython.equals(row.get("passengerpython")));
assertTrue("PassengerNodejs should be " + newPassengerNodejs + " but is " + row.get("passengernodejs"), newPassengerNodejs.equals(row.get("passengernodejs")));
assertTrue("PassengerRuby should be " + newPassengerRuby + " but is " + row.get("passengerruby"), newPassengerRuby.equals(row.get("passengerruby")));
assertTrue("FcgiPhpBin should be " + newFcgiPhpBin + " but is " + row.get("fcgiphpbin"), newFcgiPhpBin.equals(row.get("fcgiphpbin")));
String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
Arrays.sort(newDomainOptions);
Arrays.sort(checkDomainOptions);
@ -193,6 +217,12 @@ public class DomainTest {
}
}
private Boolean isNullOrEmpty(Object s) {
if (s == null) return true;
if (((String)s).equals("")) return true;
return false;
}
@Test
public void testCreateForeignSubdomain() throws UnknownHostException, IOException {
int count = getDomsCount();