def test_only_host_path(self, mock_get): mock_get.return_value = "/foo/bar/host:" returned_dict = _get_mount_path("service-init") expected_dict = {"host_path": "/foo/bar/host", "container_path": ""} self.assertEqual(expected_dict, returned_dict)
def test_host_path_is_specifed(self, mock_conf): mock_conf.return_value = "/foo/bar/host:" returned_dict = _get_mount_path("test") expected_dict = {"host_path": "/foo/bar/host", "container_path": ""} self.assertEqual(expected_dict, returned_dict)
def test_if_service_name_is_changed(self, mock_conf): mock_conf.return_value = "test:test" _get_mount_path("foo-bar") mock_conf.assert_called_with("foo_bar_mpath")
def test_opt_does_not_exist(self, mock_conf): mock_conf.side_effect = cfg.NoSuchOptError("") returned_dict = _get_mount_path("test") expected_dict = {} self.assertEqual(expected_dict, returned_dict)