Commit b1c9b1c5 authored by Rafael Monnerat's avatar Rafael Monnerat

[slapos_rest_api] Only show informations which are relevant

  Don't show close computers on rest API when list, it is not relevant for monitoring
  Don't list request_destroyed software instances or looking for partition, as it is not
    relevent for monitoring.
parent 899c423e
......@@ -599,9 +599,21 @@ class StatusPublisher(GenericPublisher):
self.__status_list()
def __status_list(self):
portal = self.getPortalObject()
open_friend = portal.restrictedTraverse(
"portal_categories/allocation_scope/open/friend" None).getUid()
open_personal = portal.restrictedTraverse(
"portal_categories/allocation_scope/open/personal", None).getUid()
open_public = portal.restrictedTraverse(
"portal_categories/allocation_scope/open/public", None).getUid()
kw = dict(
portal_type=('Computer', 'Software Instance'),
validation_state="validated",
default_allocation_scope_uid=[open_friend,
open_personal,
open_public],
slap_state=['start_requested','stop_requested']
)
d = {"list": []}
a = d['list'].append
......
......@@ -1931,3 +1931,21 @@ class TestStatusGET(SlapOSRestAPIV1InstanceMixin):
'list': ['/'.join([self.api_url, 'status',
self.software_instance.getRelativeUrl()])]
}, self.json_response)
def test_check_no_destroyed_instance(self):
self.software_instance = self.createSoftwareInstance(self.customer)
self.software_instance.edit(slap_state='destroy_requested')
transaction.commit()
self.connection.request(method='GET',
url='/'.join([self.api_path, 'status']),
headers={'REMOTE_USER': self.customer_reference})
self.prepareResponse()
self.assertBasicResponse()
self.assertResponseCode(200)
self.assertCacheControlHeader()
self.assertResponseJson()
self.assertEqual({
'list': []
}, self.json_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