Ver código fonte

use root@local.local instead of root as admin user in tests

tags/v1.4.37
Jonathan Cobb 3 anos atrás
pai
commit
aa75b181dc
16 arquivos alterados com 33 adições e 35 exclusões
  1. +2
    -2
      bubble-server/src/main/java/bubble/ApiConstants.java
  2. +4
    -4
      bubble-server/src/main/java/bubble/dao/account/AccountDAO.java
  3. +0
    -1
      bubble-server/src/main/java/bubble/resources/account/AccountsResource.java
  4. +2
    -3
      bubble-server/src/test/java/bubble/test/ActivatedBubbleModelTestBase.java
  5. +2
    -2
      bubble-server/src/test/java/bubble/test/live/S3StorageTest.java
  6. +2
    -2
      bubble-server/src/test/resources/models/include/fork.json
  7. +1
    -1
      bubble-server/src/test/resources/models/include/new_bubble.json
  8. +1
    -1
      bubble-server/src/test/resources/models/system/account_testDevice.json
  9. +1
    -1
      bubble-server/src/test/resources/models/system/cloudService.json
  10. +1
    -1
      bubble-server/src/test/resources/models/tests/auth/basic_auth.json
  11. +3
    -3
      bubble-server/src/test/resources/models/tests/auth/change_admin_password.json
  12. +5
    -5
      bubble-server/src/test/resources/models/tests/auth/change_password.json
  13. +4
    -4
      bubble-server/src/test/resources/models/tests/auth/network_auth.json
  14. +2
    -2
      bubble-server/src/test/resources/models/tests/live/backup_and_restore.json
  15. +1
    -1
      bubble-server/src/test/resources/models/tests/live/fork_sage.json
  16. +2
    -2
      bubble-server/src/test/resources/models/tests/network/network_keys.json

+ 2
- 2
bubble-server/src/main/java/bubble/ApiConstants.java Ver arquivo

@@ -294,8 +294,8 @@ public class ApiConstants {
public static final int ERROR_MAX_BEFORE_ELLIPSES = 19900;

public static final String API_TAG_ACTIVATION = "activation";
public static final String API_TAG_AUTH = "auth";
public static final String API_TAG_ACCOUNT = "account";
public static final String API_TAG_AUTH = "authentication / authorization";
public static final String API_TAG_ACCOUNT = "account management";
public static final String API_TAG_ACCOUNT_OBJECTS = "account-owned objects";
public static final String API_TAG_APPS = "bubble apps";
public static final String API_TAG_DEVICES = "devices";


+ 4
- 4
bubble-server/src/main/java/bubble/dao/account/AccountDAO.java Ver arquivo

@@ -18,7 +18,10 @@ import bubble.dao.device.DeviceDAO;
import bubble.model.account.*;
import bubble.model.app.*;
import bubble.model.bill.BubblePlan;
import bubble.model.cloud.*;
import bubble.model.cloud.BubbleDomain;
import bubble.model.cloud.BubbleNetwork;
import bubble.model.cloud.BubbleNode;
import bubble.model.cloud.CloudService;
import bubble.server.BubbleConfiguration;
import bubble.service.SearchService;
import bubble.service.account.SyncAccountService;
@@ -46,8 +49,6 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

import static bubble.ApiConstants.getRemoteHost;
import static bubble.model.account.Account.ROOT_EMAIL;
import static bubble.model.account.Account.ROOT_USERNAME;
import static bubble.model.account.AccountTemplate.copyTemplateObjects;
import static bubble.model.account.AutoUpdatePolicy.EMPTY_AUTO_UPDATE_POLICY;
import static bubble.server.BubbleConfiguration.getDEFAULT_LOCALE;
@@ -99,7 +100,6 @@ public class AccountDAO extends AbstractCRUDDAO<Account> implements SqlViewSearc
}

public Account findByEmail(String email) {
if (email.equals(ROOT_EMAIL)) email = ROOT_USERNAME;
return findByUniqueField("email", email.trim());
}



+ 0
- 1
bubble-server/src/main/java/bubble/resources/account/AccountsResource.java Ver arquivo

@@ -845,7 +845,6 @@ public class AccountsResource {
this.caller = userPrincipal(ctx);
this.id = id;
if (id != null) {
if (id.equals(ROOT_EMAIL)) id = ROOT_USERNAME;
account = accountDAO.findById(id);
if (account == null) {
if (okNotFound) return;


+ 2
- 3
bubble-server/src/test/java/bubble/test/ActivatedBubbleModelTestBase.java Ver arquivo

@@ -36,7 +36,6 @@ import java.util.stream.Collectors;

import static bubble.ApiConstants.*;
import static bubble.model.account.Account.ROOT_EMAIL;
import static bubble.model.account.Account.ROOT_USERNAME;
import static org.cobbzilla.util.daemon.ZillaRuntime.*;
import static org.cobbzilla.util.handlebars.HandlebarsUtil.applyReflectively;
import static org.cobbzilla.util.io.StreamUtil.stream2string;
@@ -80,7 +79,7 @@ public abstract class ActivatedBubbleModelTestBase extends BubbleModelTestBase {

@Override protected @NonNull Map<String, Object> modelTest(final String name, ApiRunner apiRunner) throws Exception {
getApi().logout();
final Account root = getApi().post(AUTH_ENDPOINT + EP_LOGIN, new LoginRequest(ROOT_USERNAME, ROOT_PASSWORD), Account.class);
final Account root = getApi().post(AUTH_ENDPOINT + EP_LOGIN, new LoginRequest(ROOT_EMAIL, ROOT_PASSWORD), Account.class);
if (empty(root.getToken())) die("modelTest: error logging in root user (was MFA configured in a previous test?): "+json(root));
getApi().pushToken(root.getToken());
apiRunner.addNamedSession(ROOT_SESSION, root.getToken());
@@ -133,7 +132,7 @@ public abstract class ActivatedBubbleModelTestBase extends BubbleModelTestBase {
} catch (ValidationException e) {
if (e.hasViolations() && e.getViolations().containsKey("err.activation.alreadyDone")) {
log.warn("onStart: activation already done, trying to login: " + shortError(e));
admin = client.post(AUTH_ENDPOINT + EP_LOGIN, new LoginRequest(ROOT_USERNAME, ROOT_PASSWORD), Account.class);
admin = client.post(AUTH_ENDPOINT + EP_LOGIN, new LoginRequest(ROOT_EMAIL, ROOT_PASSWORD), Account.class);
} else {
throw e;
}


+ 2
- 2
bubble-server/src/test/java/bubble/test/live/S3StorageTest.java Ver arquivo

@@ -31,7 +31,7 @@ import java.util.List;
import static bubble.ApiConstants.*;
import static bubble.cloud.storage.StorageCryptStream.MIN_DISTINCT_LENGTH;
import static bubble.cloud.storage.StorageCryptStream.MIN_KEY_LENGTH;
import static bubble.model.account.Account.ROOT_USERNAME;
import static bubble.model.account.Account.ROOT_EMAIL;
import static bubble.model.cloud.CloudCredentials.PARAM_KEY;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric;
import static org.cobbzilla.util.daemon.ZillaRuntime.die;
@@ -73,7 +73,7 @@ public class S3StorageTest extends NetworkTestBase {
cloudDAO.update(s3cloud.setDriverConfigJson(json(config.setListFetchSize(LIST_FETCH_SIZE))));

comment = "login, start api session";
final Account root = getApi().post(AUTH_ENDPOINT + EP_LOGIN, new LoginRequest(ROOT_USERNAME, ROOT_PASSWORD), Account.class);
final Account root = getApi().post(AUTH_ENDPOINT + EP_LOGIN, new LoginRequest(ROOT_EMAIL, ROOT_PASSWORD), Account.class);
if (empty(root.getToken())) die("modelTest: error logging in root user (was MFA configured in a previous test?): "+json(root));
getApi().pushToken(root.getToken());



+ 2
- 2
bubble-server/src/test/resources/models/include/fork.json Ver arquivo

@@ -3,7 +3,7 @@
"comment": "declare default parameters for fork test part",
"include": "_defaults",
"params": {
"rootUsername": "root",
"rootUsername": "root@local.local",
"rootPassword": "password1!",
"email": "user-<<rand 5>>@example.com",
"planVar": "plan",
@@ -25,7 +25,7 @@
"comment": "add email contact for root user",
"include": "add_approved_contact",
"params": {
"username": "root",
"username": "root@local.local",
"userSession": "rootSession",
"contactInfo": "<<email>>",
"contactLookup": "<<email>>"


+ 1
- 1
bubble-server/src/test/resources/models/include/new_bubble.json Ver arquivo

@@ -3,7 +3,7 @@
"comment": "declare default parameters for new_bubble test part",
"include": "_defaults",
"params": {
"rootUsername": "root",
"rootUsername": "root@local.local",
"rootPassword": "password1!",
"sageFqdn": "_required",
"sageConnectionVar": "sageConnection",


+ 1
- 1
bubble-server/src/test/resources/models/system/account_testDevice.json Ver arquivo

@@ -1,6 +1,6 @@
[
{
"email": "root",
"uuid": "root@local.local",
"children": {
"Device": [ {"name": "test", "deviceType": "other"} ]
}


+ 1
- 1
bubble-server/src/test/resources/models/system/cloudService.json Ver arquivo

@@ -256,7 +256,7 @@
"vars": [{"name": "DIGITALOCEAN_API_KEY", "value": "[[credentials.apiKey]]"}],
"builder": {
"type": "digitalocean",
"ssh_username": "root",
"ssh_username": "root@local.local",
"api_token": "[[user `DIGITALOCEAN_API_KEY`]]",
"image": "ubuntu-18-04-x64",
"region": "<<buildRegion.internalName>>",


+ 1
- 1
bubble-server/src/test/resources/models/tests/auth/basic_auth.json Ver arquivo

@@ -25,7 +25,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "password1!"
}
},


+ 3
- 3
bubble-server/src/test/resources/models/tests/auth/change_admin_password.json Ver arquivo

@@ -12,7 +12,7 @@
"comment": "update root policy, add authenticator",
"include": "add_authenticator",
"params": {
"userId": "root",
"userId": "root@local.local",
"authenticatorVar": "rootAuthenticator"
}
},
@@ -112,7 +112,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "password1!"
}
},
@@ -127,7 +127,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "aNewRootPass1!",
"totpToken": "{{authenticator_token rootAuthenticator.totpKey}}"
}


+ 5
- 5
bubble-server/src/test/resources/models/tests/auth/change_password.json Ver arquivo

@@ -5,7 +5,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "password1!"
}
},
@@ -37,7 +37,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "password1!"
}
},
@@ -52,7 +52,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "password2!"
}
},
@@ -74,7 +74,7 @@
"comment": "update root policy, add authenticator",
"include": "add_authenticator",
"params": {
"userId": "root",
"userId": "root@local.local",
"authenticatorVar": "rootAuthenticator"
}
},
@@ -125,7 +125,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "password3!",
"totpToken": "{{authenticator_token rootAuthenticator.totpKey}}"
}


+ 4
- 4
bubble-server/src/test/resources/models/tests/auth/network_auth.json Ver arquivo

@@ -3,7 +3,7 @@
"comment": "add email contact for root user",
"include": "add_approved_contact",
"params": {
"username": "root",
"username": "root@local.local",
"userSession": "rootSession",
"contactInfo": "root@example.com",
"contactLookup": "root@example.com"
@@ -14,7 +14,7 @@
"comment": "add authenticator as required auth factor",
"include": "add_authenticator",
"params": {
"userId": "root",
"userId": "root@local.local",
"authFactor": "required"
}
},
@@ -58,7 +58,7 @@
"request": {
"uri": "auth/authenticator",
"entity": {
"account": "root",
"account": "root@local.local",
"token": "{{authenticator_token authenticator.totpKey}}",
"authenticate": true
}
@@ -132,7 +132,7 @@
"request": {
"uri": "auth/authenticator",
"entity": {
"account": "root",
"account": "root@local.local",
"token": "{{authenticator_token authenticator.totpKey}}",
"authenticate": true
}


+ 2
- 2
bubble-server/src/test/resources/models/tests/live/backup_and_restore.json Ver arquivo

@@ -10,7 +10,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"username": "root",
"username": "root@local.local",
"password": "{{sageRootPass}}"
}
},
@@ -25,7 +25,7 @@
"comment": "add root@example.com as email contact for root user, if not already present",
"include": "add_approved_contact",
"params": {
"username": "root",
"username": "root@local.local",
"userSession": "nnRootSession",
"userConnection": "sageConnection",
"rootSession": "nnRootSession",


+ 1
- 1
bubble-server/src/test/resources/models/tests/live/fork_sage.json Ver arquivo

@@ -22,7 +22,7 @@
"session": "new",
"uri": "auth/login",
"entity": {
"name": "root",
"name": "root@local.local",
"password": "{{sageRootPass}}"
}
},


+ 2
- 2
bubble-server/src/test/resources/models/tests/network/network_keys.json Ver arquivo

@@ -3,7 +3,7 @@
"comment": "add email contact for root user",
"include": "add_approved_contact",
"params": {
"username": "root",
"username": "root@local.local",
"userSession": "rootSession",
"contactInfo": "root@example.com",
"contactLookup": "root@example.com"
@@ -127,7 +127,7 @@
"comment": "add sms as required for node operations",
"include": "add_approved_contact",
"params": {
"username": "root",
"username": "root@local.local",
"userSession": "rootSession",
"contactType": "sms",
"contactInfo": "US:800-555-1212",


Carregando…
Cancelar
Salvar