def test_cluster_status(self): self.check_output.return_value = b'Cluster status OK' actions.cluster_status([]) self.check_output.assert_called_once_with(['rabbitmqctl', 'cluster_status'], universal_newlines=True) self.action_set.assert_called()
def test_cluster_status_execption(self): self.check_output.side_effect = actions.CalledProcessError( 1, "Failure") actions.cluster_status([]) self.check_output.assert_called_once_with( ['rabbitmqctl', 'cluster_status'], universal_newlines=True) self.action_set.assert_called() self.action_fail.assert_called()
def test_cluster_status_exception(self): self.check_output.side_effect = actions.CalledProcessError(1, "Failure") actions.cluster_status([]) self.check_output.assert_called_once_with(['rabbitmqctl', 'cluster_status'], universal_newlines=True) self.action_set.assert_called() self.action_fail.assert_called()
def test_cluster_status_json(self): self.rabbitmq_version_newer_or_equal.return_value = True self.check_output.return_value = json.dumps( {"Status": "Cluster status OK"}) actions.cluster_status([]) self.check_output.assert_called_once_with( ['rabbitmqctl', 'cluster_status', '--formatter', 'json'], universal_newlines=True) self.action_set.assert_called()
def test_cluster_status_exception_json(self): self.rabbitmq_version_newer_or_equal.return_value = True self.check_output.side_effect = actions.CalledProcessError( 1, "Failure") actions.cluster_status([]) self.check_output.assert_called_once_with( ['rabbitmqctl', 'cluster_status', '--formatter', 'json'], universal_newlines=True) self.action_set.assert_called() self.action_fail.assert_called()