// XXX TODO Filter by default_strict_allocation_scope_uid="!=%s" % context.getPortalObject().portal_categories.allocation_scope.close.forever.getUid(),
@@ -378,19 +467,24 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -378,19 +467,24 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
compute_node=self._makeComputeNode()
compute_node=self._makeComputeNode()
self._logFakeAccess(compute_node)
self._logFakeAccess(compute_node)
news_dict=compute_node.ComputeNode_getNewsDict()
news_dict=compute_node.ComputeNode_getNewsDict()
monitor_url='https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s'%(compute_node.getReference())
expected_news_dict={'compute_node':
expected_news_dict={'compute_node':
{'created_at':self.created_at,
{'created_at':self.created_at,
'no_data_since_15_minutes':0,
'no_data_since_15_minutes':0,
'no_data_since_5_minutes':0,
'no_data_since_5_minutes':0,
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'since':self.created_at,
'since':self.created_at,
'state':'start_requested',
'state':'start_requested',
'text':'#access OK',
'text':'#access OK',
'user':'SlapOS Master'},
'user':'SlapOS Master'},
'partition':{}
'partition':{},
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'monitor_url':monitor_url
}
}
self.assertEqual(news_dict,expected_news_dict)
self.assertEqual(_decode_with_json(news_dict),
# Ensure it don't raise error when converting to JSON
_decode_with_json(expected_news_dict))
json.dumps(news_dict)
deftest_stopped(self):
deftest_stopped(self):
compute_node=self._makeComputeNode()
compute_node=self._makeComputeNode()
...
@@ -398,20 +492,25 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -398,20 +492,25 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
monitor_url='https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s'%(compute_node.getReference())
expected_news_dict={'compute_node':
expected_news_dict={'compute_node':
{'created_at':self.created_at,
{'created_at':self.created_at,
'no_data_since_15_minutes':0,
'no_data_since_15_minutes':0,
'no_data_since_5_minutes':0,
'no_data_since_5_minutes':0,
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'since':self.created_at,
'since':self.created_at,
'state':'stop_requested',
'state':'stop_requested',
'text':'#access OK',
'text':'#access OK',
'user':'SlapOS Master'},
'user':'SlapOS Master'},
'partition':{}
'partition':{},
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'monitor_url':monitor_url
}
}
self.assertEqual(news_dict,expected_news_dict)
self.assertEqual(_decode_with_json(news_dict),
# Ensure it don't raise error when converting to JSON
_decode_with_json(expected_news_dict))
json.dumps(news_dict)
deftest_destroyed(self):
deftest_destroyed(self):
compute_node=self._makeComputeNode()
compute_node=self._makeComputeNode()
...
@@ -419,41 +518,52 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -419,41 +518,52 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
monitor_url='https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s'%(compute_node.getReference())
expected_news_dict={'compute_node':
expected_news_dict={'compute_node':
{'created_at':self.created_at,
{'created_at':self.created_at,
'no_data_since_15_minutes':0,
'no_data_since_15_minutes':0,
'no_data_since_5_minutes':0,
'no_data_since_5_minutes':0,
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'since':self.created_at,
'since':self.created_at,
'state':'destroy_requested',
'state':'destroy_requested',
'text':'#access OK',
'text':'#access OK',
'user':'SlapOS Master'},
'user':'SlapOS Master'},
'partition':{}
'partition':{},
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'monitor_url':monitor_url
}
}
self.assertEqual(news_dict,expected_news_dict)
self.assertEqual(_decode_with_json(news_dict),
# Ensure it don't raise error when converting to JSON
_decode_with_json(expected_news_dict))
json.dumps(news_dict)
deftest_no_data(self):
deftest_no_data(self):
compute_node=self._makeComputeNode()
compute_node=self._makeComputeNode()
news_dict=compute_node.ComputeNode_getNewsDict()
news_dict=compute_node.ComputeNode_getNewsDict()
monitor_url='https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s'%(compute_node.getReference())
expected_news_dict={'compute_node':
expected_news_dict={'compute_node':
{'created_at':self.created_at,
{'created_at':self.created_at,
'no_data':1,
'no_data':1,
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'since':self.created_at,
'since':self.created_at,
'state':'',
'state':'',
'text':'#error no data found for %s'%compute_node.getReference(),
'text':'#error no data found for %s'%compute_node.getReference(),
'user':'SlapOS Master'},
'user':'SlapOS Master'},
'partition':{}
'partition':{},
'portal_type':compute_node.getPortalType(),
'reference':compute_node.getReference(),
'monitor_url':monitor_url
}
}
self.assertEqual(news_dict,expected_news_dict)
self.assertEqual(_decode_with_json(news_dict),
# Ensure it don't raise error when converting to JSON
monitor_url='https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s'%(compute_node.getReference())
self.tic()
self.tic()
self._logFakeAccess(compute_node)
self._logFakeAccess(compute_node)
...
@@ -462,20 +572,26 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -462,20 +572,26 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):