Commit 705bb5aa authored by Titouan Soulard's avatar Titouan Soulard

slapos_jio_api_style: update API to use project_reference

parent 73ec3f56
...@@ -48,7 +48,8 @@ try: ...@@ -48,7 +48,8 @@ try:
instance_xml=castToStr(partition_parameter), instance_xml=castToStr(partition_parameter),
shared=data_dict.get("shared", False), shared=data_dict.get("shared", False),
sla_xml=castToStr(filter_kw), sla_xml=castToStr(filter_kw),
state=data_dict.get("state", "started")) state=data_dict.get("state", "started"),
project_reference=data_dict.get("project_reference"))
if compute_node_id and compute_partition_id: if compute_node_id and compute_partition_id:
compute_partition = portal.portal_catalog.getComputePartitionObject( compute_partition = portal.portal_catalog.getComputePartitionObject(
......
...@@ -975,11 +975,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -975,11 +975,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try: try:
requestInstance = instance.__class__.requestInstance requestInstance = instance.__class__.requestInstance
project_reference = self.project.getReference()
instance.__class__.requestInstance = calledRequestInstance instance.__class__.requestInstance = calledRequestInstance
partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference() partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference()
self.login(instance.getUserId()) self.login(instance.getUserId())
response_dict = self.postToApi({ response_dict = self.postToApi({
"portal_type": "Software Instance", "portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release", "software_release_uri": "req_release",
"software_type": "req_type", "software_type": "req_type",
"title": "req_reference", "title": "req_reference",
...@@ -994,6 +996,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -994,6 +996,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type')) response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, { self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n", 'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
"project_reference": project_reference,
'software_title': 'req_reference', 'software_title': 'req_reference',
'software_release': 'req_release', 'software_release': 'req_release',
'state': 'started', 'state': 'started',
...@@ -1021,11 +1024,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1021,11 +1024,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try: try:
requestInstance = instance.__class__.requestInstance requestInstance = instance.__class__.requestInstance
project_reference = self.project.getReference()
instance.__class__.requestInstance = calledRequestInstance instance.__class__.requestInstance = calledRequestInstance
partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference() partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference()
self.login(instance.getUserId()) self.login(instance.getUserId())
response_dict = self.postToApi({ response_dict = self.postToApi({
"portal_type": "Software Instance", "portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release", "software_release_uri": "req_release",
"software_type": "req_type", "software_type": "req_type",
"title": "req_reference", "title": "req_reference",
...@@ -1039,6 +1044,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1039,6 +1044,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type')) response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, { self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n", 'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
"project_reference": project_reference,
'software_title': 'req_reference', 'software_title': 'req_reference',
'software_release': 'req_release', 'software_release': 'req_release',
'shared': False, 'shared': False,
...@@ -1066,11 +1072,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1066,11 +1072,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try: try:
requestInstance = instance.__class__.requestInstance requestInstance = instance.__class__.requestInstance
project_reference = self.project.getReference()
instance.__class__.requestInstance = calledRequestInstance instance.__class__.requestInstance = calledRequestInstance
partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference() partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference()
self.login(instance.getUserId()) self.login(instance.getUserId())
response_dict = self.postToApi({ response_dict = self.postToApi({
"portal_type": "Software Instance", "portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release", "software_release_uri": "req_release",
"software_type": "req_type", "software_type": "req_type",
"title": "req_reference", "title": "req_reference",
...@@ -1085,6 +1093,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1085,6 +1093,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type')) response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, { self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n", 'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
"project_reference": project_reference,
'software_title': 'req_reference', 'software_title': 'req_reference',
'software_release': 'req_release', 'software_release': 'req_release',
'shared': False, 'shared': False,
...@@ -1409,10 +1418,12 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1409,10 +1418,12 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
try: try:
requestSoftwareInstance = self.person.__class__.requestSoftwareInstance requestSoftwareInstance = self.person.__class__.requestSoftwareInstance
project_reference = self.project.getReference()
self.person.__class__.requestSoftwareInstance = calledRequestInstance self.person.__class__.requestSoftwareInstance = calledRequestInstance
self.login(self.person_user_id) self.login(self.person_user_id)
response_dict = self.postToApi({ response_dict = self.postToApi({
"portal_type": "Software Instance", "portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release", "software_release_uri": "req_release",
"software_type": "req_type", "software_type": "req_type",
"title": "req_reference", "title": "req_reference",
...@@ -1425,6 +1436,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1425,6 +1436,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type')) response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, { self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n", 'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
'project_reference': project_reference,
'software_title': 'req_reference', 'software_title': 'req_reference',
'software_release': 'req_release', 'software_release': 'req_release',
'state': 'started', 'state': 'started',
...@@ -1449,6 +1461,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1449,6 +1461,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
try: try:
requestSoftwareInstance = self.person.__class__.requestSoftwareInstance requestSoftwareInstance = self.person.__class__.requestSoftwareInstance
project_reference = self.project.getReference()
self.person.__class__.requestSoftwareInstance = calledRequestInstance self.person.__class__.requestSoftwareInstance = calledRequestInstance
self.login(self.person_user_id) self.login(self.person_user_id)
response_dict = self.postToApi({ response_dict = self.postToApi({
...@@ -1456,6 +1469,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1456,6 +1469,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
"software_release_uri": "req_release", "software_release_uri": "req_release",
"software_type": "req_type", "software_type": "req_type",
"title": "req_reference", "title": "req_reference",
"project_reference": project_reference
}) })
response = self.portal.REQUEST.RESPONSE response = self.portal.REQUEST.RESPONSE
if 400 != response.getStatus(): if 400 != response.getStatus():
...@@ -1464,6 +1478,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1464,6 +1478,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type')) response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, { self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n", 'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
'project_reference': project_reference,
'software_title': 'req_reference', 'software_title': 'req_reference',
'software_release': 'req_release', 'software_release': 'req_release',
'state': 'started', 'state': 'started',
...@@ -1498,6 +1513,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1498,6 +1513,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
"software_release_uri": instance.getUrlString(), "software_release_uri": instance.getUrlString(),
"software_type": instance.getSourceReference(), "software_type": instance.getSourceReference(),
"title": instance.getTitle(), "title": instance.getTitle(),
"project_reference": self.project.getReference()
}) })
response = self.portal.REQUEST.RESPONSE response = self.portal.REQUEST.RESPONSE
......
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