Commit 3b4caec0 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: create normal user with the project customer assignment

parent 88e44bb7
...@@ -222,7 +222,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -222,7 +222,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.admin_user = admin_user self.admin_user = admin_user
def createNormalUser(self, email, name, language): def createNormalUser(self, email, name, language, project):
""" Create a Normal user """ """ Create a Normal user """
normal_user_login = self.portal.portal_catalog.getResultValue( normal_user_login = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login", portal_type="ERP5 Login",
...@@ -248,9 +248,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -248,9 +248,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
assignment.open() assignment.open()
normal_user.validate() normal_user.validate()
self.normal_user = normal_user
else: else:
self.normal_user = normal_user_login.getParentValue() normal_user = normal_user_login.getParentValue()
normal_user.newContent(
portal_type='Assignment',
destination_project_value=project,
function='customer'
).open()
self.normal_user = normal_user
self.normal_user.setLanguage(language) self.normal_user.setLanguage(language)
def createChineseSubscriptionCondition(self, slave=False): def createChineseSubscriptionCondition(self, slave=False):
...@@ -1688,7 +1695,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1688,7 +1695,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
name="ABC %s" % self.new_id name="ABC %s" % self.new_id
self.login() self.login()
self.createNormalUser(default_email_text, name, language) self.createNormalUser(default_email_text, name, language, self.subscription_project)
self.tic() self.tic()
self.subscription_server = self.createPublicServerForAdminUser() self.subscription_server = self.createPublicServerForAdminUser()
...@@ -1715,9 +1722,10 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1715,9 +1722,10 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# 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
name="ABC %s" % self.new_id name="ABC %s" % self.new_id
project_reference = self.subscription_project.getReference()
self.login() self.login()
self.createNormalUser(default_email_text, name, language) self.createNormalUser(default_email_text, name, language, self.subscription_project)
self.tic() self.tic()
self.subscription_server = self.createPublicServerForAdminUser() self.subscription_server = self.createPublicServerForAdminUser()
...@@ -1737,6 +1745,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1737,6 +1745,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
software_release=self.subscription_condition.getUrlString(), software_release=self.subscription_condition.getUrlString(),
software_type="default", software_type="default",
partition_reference="_test_subscription_scenario_with_existing_user_extra_instance", partition_reference="_test_subscription_scenario_with_existing_user_extra_instance",
project_reference=project_reference
) )
self.non_subscription_related_instance_amount = 1 self.non_subscription_related_instance_amount = 1
......
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