Procházet zdrojové kódy

allow default plan

tags/v0.17.0
Jonathan Cobb před 4 roky
rodič
revize
5dc2bd64ff
4 změnil soubory, kde provedl 82 přidání a 18 odebrání
  1. +7
    -1
      bubble-server/src/main/java/bubble/resources/bill/AccountPlansResource.java
  2. +4
    -3
      bubble-server/src/test/java/bubble/test/system/NetworkTest.java
  3. +2
    -14
      bubble-server/src/test/resources/models/tests/network/minimal_launch.json
  4. +69
    -0
      bubble-server/src/test/resources/models/tests/network/preferred_plan_launch.json

+ 7
- 1
bubble-server/src/main/java/bubble/resources/bill/AccountPlansResource.java Zobrazit soubor

@@ -184,7 +184,13 @@ public class AccountPlansResource extends AccountOwnedResource<AccountPlan, Acco
if (plan == null) {
plan = planDAO.findByUuid(caller.getPreferredPlan());
if (plan == null) {
errors.addViolation("err.plan.required");
final List<BubblePlan> bubblePlans = planDAO.findAll();
if (empty(bubblePlans)) {
errors.addViolation("err.plan.required");
} else {
plan = bubblePlans.get(0);
request.setPlan(plan.getUuid());
}
} else {
request.setPlan(plan.getUuid());
}


+ 4
- 3
bubble-server/src/test/java/bubble/test/system/NetworkTest.java Zobrazit soubor

@@ -10,8 +10,9 @@ import org.junit.Test;
@Slf4j
public class NetworkTest extends NetworkTestBase {

@Test public void testRegions () throws Exception { modelTest("network/network_regions"); }
@Test public void testGetNetworkKeys () throws Exception { modelTest("network/network_keys"); }
@Test public void testMinimalLaunch () throws Exception { modelTest("network/minimal_launch"); }
@Test public void testRegions () throws Exception { modelTest("network/network_regions"); }
@Test public void testGetNetworkKeys () throws Exception { modelTest("network/network_keys"); }
@Test public void testPreferredPlanLaunch () throws Exception { modelTest("network/preferred_plan_launch"); }
@Test public void testMinimalLaunch () throws Exception { modelTest("network/minimal_launch"); }

}

+ 2
- 14
bubble-server/src/test/resources/models/tests/network/minimal_launch.json Zobrazit soubor

@@ -9,26 +9,14 @@
},

{
"comment": "list plans",
"request": { "uri": "plans" },
"response": {
"store": "plans",
"check": [
{"condition": "json.length > 0"}
]
}
},

{
"comment": "add a payment method and preferred plan",
"comment": "add a payment method",
"before": "stripe_tokenize_card",
"request": {
"uri": "me/paymentMethods",
"method": "put",
"entity": {
"paymentMethodType": "credit",
"paymentInfo": "{{stripeToken}}",
"preferredPlan": "{{plans.[0].name}}"
"paymentInfo": "{{stripeToken}}"
}
}
},


+ 69
- 0
bubble-server/src/test/resources/models/tests/network/preferred_plan_launch.json Zobrazit soubor

@@ -0,0 +1,69 @@
[
{
"comment": "create another account and login",
"include": "new_account",
"params": {
"email": "pref_plan_launch@example.com",
"verifyEmail": true
}
},

{
"comment": "list plans",
"request": { "uri": "plans" },
"response": {
"store": "plans",
"check": [
{"condition": "json.length > 0"}
]
}
},

{
"comment": "add a payment method and preferred plan",
"before": "stripe_tokenize_card",
"request": {
"uri": "me/paymentMethods",
"method": "put",
"entity": {
"paymentMethodType": "credit",
"paymentInfo": "{{stripeToken}}",
"preferredPlan": "{{plans.[0].name}}"
}
}
},

{
"comment": "add account plan",
"request": {
"uri": "me/plans",
"method": "put",
"entity": {}
},
"response": { "store": "plan" }
},

{
"comment": "start the network. sets up the first node, which does the rest",
"request": {
"uri": "me/networks/{{ plan.name }}/actions/start",
"method": "post"
},
"response": {
"store": "<<networkVar>>"
}
},

{
"comment": "list networks, verify new network is starting",
"before": "sleep 10s",
"request": { "uri": "me/networks" },
"response": {
"check": [
{"condition": "json.length === 1"},
{"condition": "json[0].getName() === '{{plan.name}}'"},
{"condition": "json[0].getState().name() === 'starting'"}
]
}
}
]

Načítá se…
Zrušit
Uložit