Commit ecc697f5 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Make _test* more flexible for further customizations

parent 78df4788
...@@ -982,7 +982,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -982,7 +982,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
def _test_subscription_scenario(self, amount=1): def _test_subscription_scenario(self, amount=1):
""" The admin creates an computer, user can request instances on it""" """ The admin creates an computer, user can request instances on it"""
subscription_server = self.createPublicServerForAdminUser() self.subscription_server = self.createPublicServerForAdminUser()
# Call as anonymous... check response? # Call as anonymous... check response?
default_email_text = "abc%s@nexedi.com" % self.new_id default_email_text = "abc%s@nexedi.com" % self.new_id
...@@ -992,12 +992,14 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -992,12 +992,14 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
amount, name, default_email_text) amount, name, default_email_text)
self.checkSubscriptionDeploymentAndSimulation( self.checkSubscriptionDeploymentAndSimulation(
default_email_text, subscription_server) default_email_text, self.subscription_server)
self.destroyAndCheckSubscription( self.destroyAndCheckSubscription(
default_email_text, subscription_server default_email_text, self.subscription_server
) )
return default_email_text, name
def _test_subscription_scenario_with_existing_user(self, amount=1, language=None): def _test_subscription_scenario_with_existing_user(self, amount=1, language=None):
""" The admin creates an computer, user can request instances on it""" """ The admin creates an computer, user can request instances on it"""
...@@ -1009,13 +1011,13 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -1009,13 +1011,13 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.createNormalUser(default_email_text, name, language) self.createNormalUser(default_email_text, name, language)
self.tic() self.tic()
subscription_server = self.createPublicServerForAdminUser() self.subscription_server = self.createPublicServerForAdminUser()
self.requestAndCheckHostingSubscription( self.requestAndCheckHostingSubscription(
amount, name, default_email_text) amount, name, default_email_text)
self.checkSubscriptionDeploymentAndSimulation( self.checkSubscriptionDeploymentAndSimulation(
default_email_text, subscription_server) default_email_text, self.subscription_server)
subscription_request = self.getSubscriptionRequest( subscription_request = self.getSubscriptionRequest(
default_email_text, self.subscription_condition) default_email_text, self.subscription_condition)
...@@ -1024,14 +1026,17 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -1024,14 +1026,17 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
subscription_request.getDestinationSectionValue()) subscription_request.getDestinationSectionValue())
self.destroyAndCheckSubscription( self.destroyAndCheckSubscription(
default_email_text, subscription_server default_email_text, self.subscription_server
) )
return default_email_text, name
def _test_two_subscription_scenario(self, amount=1, create_invitation=False, def _test_two_subscription_scenario(self, amount=1, create_invitation=False,
max_invoice_delay=0, max_invoice_credit_eur=0.0, max_invoice_credit_cny=0.0): max_invoice_delay=0, max_invoice_credit_eur=0.0, max_invoice_credit_cny=0.0):
""" The admin creates an computer, user can request instances on it""" """ The admin creates an computer, user can request instances on it"""
subscription_server = self.createPublicServerForAdminUser() self.subscription_server = self.createPublicServerForAdminUser()
# Call as anonymous... check response? # Call as anonymous... check response?
default_email_text = "abc%s@nexedi.com" % self.new_id default_email_text = "abc%s@nexedi.com" % self.new_id
...@@ -1138,16 +1143,19 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -1138,16 +1143,19 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.tic() self.tic()
self.checkSubscriptionDeploymentAndSimulation( self.checkSubscriptionDeploymentAndSimulation(
default_email_text, subscription_server) default_email_text, self.subscription_server)
self.destroyAndCheckSubscription( self.destroyAndCheckSubscription(
default_email_text, subscription_server default_email_text, self.subscription_server
) )
return default_email_text, name
def _test_subscription_scenario_with_reversal_transaction(self, amount=1): def _test_subscription_scenario_with_reversal_transaction(self, amount=1):
""" The admin creates an computer, user can request instances on it""" """ The admin creates an computer, user can request instances on it"""
subscription_server = self.createPublicServerForAdminUser() self.subscription_server = self.createPublicServerForAdminUser()
# Call as anonymous... check response? # Call as anonymous... check response?
default_email_text = "abc%s@nexedi.com" % self.new_id default_email_text = "abc%s@nexedi.com" % self.new_id
...@@ -1155,12 +1163,15 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -1155,12 +1163,15 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.requestAndCheckHostingSubscription(amount, name, default_email_text) self.requestAndCheckHostingSubscription(amount, name, default_email_text)
self.checkSubscriptionDeploymentAndSimulationWithReversalTransaction( self.checkSubscriptionDeploymentAndSimulationWithReversalTransaction(
default_email_text, subscription_server) default_email_text, self.subscription_server)
self.destroyAndCheckSubscription( self.destroyAndCheckSubscription(
default_email_text, subscription_server default_email_text, self.subscription_server
) )
return default_email_text, name
class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin): class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
def test_subscription_scenario_with_single_vm(self): def test_subscription_scenario_with_single_vm(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment