Commit 994da796 authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_pdm: tests alarm create upgrade decision, allocation scope open/personal included

parent e56d66c6
......@@ -109,6 +109,8 @@ return %s
computer.edit(allocation_scope = 'open/public')
computer2 = self._makeComputer(self.generateNewId())
computer2.edit(allocation_scope = 'open/personal')
computer3 = self._makeComputer(self.generateNewId())
computer3.edit(allocation_scope = 'open/friend')
self._simulateScript('Computer_checkAndCreateUpgradeDecision')
try:
......@@ -121,14 +123,19 @@ return %s
self.assertEqual('Visited by Computer_checkAndCreateUpgradeDecision',
computer.workflow_history['edit_workflow'][-1]['comment'])
self.assertNotEqual('Visited by Computer_checkAndCreateUpgradeDecision',
self.assertEqual('Visited by Computer_checkAndCreateUpgradeDecision',
computer2.workflow_history['edit_workflow'][-1]['comment'])
self.assertEqual('Visited by Computer_checkAndCreateUpgradeDecision',
computer3.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_hosting_subscription_create_upgrade_decision(self):
computer = self._makeComputer(self.new_id)
computer.edit(allocation_scope = 'open/public')
computer2 = self._makeComputer(self.generateNewId())
computer2.edit(allocation_scope = 'open/personal')
computer3 = self._makeComputer(self.generateNewId())
computer3.edit(allocation_scope = 'open/friend')
self._simulateScript('Computer_createHostingSubscriptionUpgradeDecision')
try:
......@@ -141,6 +148,29 @@ return %s
self.assertEqual('Visited by Computer_createHostingSubscriptionUpgradeDecision',
computer.workflow_history['edit_workflow'][-1]['comment'])
self.assertNotEqual('Visited by Computer_createHostingSubscriptionUpgradeDecision',
self.assertEqual('Visited by Computer_createHostingSubscriptionUpgradeDecision',
computer2.workflow_history['edit_workflow'][-1]['comment'])
self.assertEqual('Visited by Computer_createHostingSubscriptionUpgradeDecision',
computer3.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_create_upgrade_decision_closed_computer(self):
computer = self._makeComputer(self.new_id)
computer.edit(allocation_scope = 'close/oudtated')
computer2 = self._makeComputer(self.generateNewId())
computer2.edit(allocation_scope = 'close/maintenance')
self._simulateScript('Computer_checkAndCreateUpgradeDecision')
try:
self.portal.portal_alarms.slapos_pdm_computer_create_upgrade_decision.\
activeSense()
self.tic()
finally:
self._dropScript('Computer_checkAndCreateUpgradeDecision')
self.assertNotEqual('Visited by Computer_checkAndCreateUpgradeDecision',
computer.workflow_history['edit_workflow'][-1]['comment'])
self.assertNotEqual('Visited by Computer_checkAndCreateUpgradeDecision',
computer2.workflow_history['edit_workflow'][-1]['comment'])
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