Example #1
0
 def test_bind_not_enabled(self, mock_binding, mock_repo, mock_node):
     # Test
     command = commands.NodeBindCommand(self.context)
     keywords = {
         commands.OPTION_REPO_ID.keyword: REPOSITORY_ID,
         commands.NODE_ID_OPTION.keyword: NODE_ID,
         commands.STRATEGY_OPTION.keyword: constants.MIRROR_STRATEGY,
     }
     command.run(**keywords)
     # Verify
     self.assertTrue(commands.OPTION_REPO_ID in command.options)
     self.assertTrue(commands.NODE_ID_OPTION in command.options)
     self.assertTrue(commands.STRATEGY_OPTION in command.options)
     self.assertTrue(mock_node.called)
     self.assertTrue(mock_repo.called)
     self.assertFalse(mock_binding.called)
Example #2
0
 def test_bind_with_strategy(self, mock_binding, *unused):
     # Test
     command = commands.NodeBindCommand(self.context)
     keywords = {
         commands.OPTION_REPO_ID.keyword: REPOSITORY_ID,
         commands.NODE_ID_OPTION.keyword: NODE_ID,
         commands.STRATEGY_OPTION.keyword: constants.MIRROR_STRATEGY,
     }
     command.run(**keywords)
     # Verify
     self.assertTrue(commands.OPTION_REPO_ID in command.options)
     self.assertTrue(commands.NODE_ID_OPTION in command.options)
     self.assertTrue(commands.STRATEGY_OPTION in command.options)
     mock_binding.assert_called_with(NODE_ID,
                                     REPOSITORY_ID,
                                     constants.HTTP_DISTRIBUTOR,
                                     notify_agent=False,
                                     binding_config={
                                         constants.STRATEGY_KEYWORD:
                                         constants.MIRROR_STRATEGY
                                     })