예제 #1
0
 def test_deactivate_not_activated(self, mock_binding, mock_activated):
     # Test
     command = commands.NodeDeactivateCommand(self.context)
     keywords = {commands.NODE_ID_OPTION.keyword: NODE_ID}
     command.run(**keywords)
     # Verify
     self.assertTrue(commands.NODE_ID_OPTION in command.options)
     mock_activated.assert_called_with(self.context, NODE_ID)
     self.assertFalse(mock_binding.called)
예제 #2
0
 def test_deactivate(self, mock_binding, mock_activated):
     # Test
     command = commands.NodeDeactivateCommand(self.context)
     keywords = {commands.NODE_ID_OPTION.keyword: NODE_ID}
     command.run(**keywords)
     # Verify
     delta = {
         'notes': {
             constants.NODE_NOTE_KEY: None,
             constants.STRATEGY_NOTE_KEY: None
         }
     }
     self.assertTrue(commands.NODE_ID_OPTION in command.options)
     mock_activated.assert_called_with(self.context, NODE_ID)
     mock_binding.assert_called_with(NODE_ID, delta)