def test_notify_about_cgsnapshot_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' output = volume_utils.notify_about_cgsnapshot_usage( mock.sentinel.context, mock.sentinel.cgsnapshot, 'test_suffix') self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.cgsnapshot) mock_rpc.get_notifier.assert_called_once_with('cgsnapshot', 'host1') mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, 'cgsnapshot.test_suffix', mock_usage.return_value)
def test_notify_about_cgsnapshot_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = "host1" output = volume_utils.notify_about_cgsnapshot_usage( mock.sentinel.context, mock.sentinel.cgsnapshot, "test_suffix" ) self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.cgsnapshot) mock_rpc.get_notifier.assert_called_once_with("cgsnapshot", "host1") mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, "cgsnapshot.test_suffix", mock_usage.return_value )
def test_notify_about_cgsnapshot_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = "host1" output = volume_utils.notify_about_cgsnapshot_usage( mock.sentinel.context, mock.sentinel.cgsnapshot, "test_suffix", extra_usage_info={"a": "b", "c": "d"}, host="host2", ) self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.cgsnapshot, a="b", c="d") mock_rpc.get_notifier.assert_called_once_with("cgsnapshot", "host2") mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, "cgsnapshot.test_suffix", mock_usage.return_value )