Revision fe4f6dca test/ganeti.vcluster_unittest.py
b/test/ganeti.vcluster_unittest.py | ||
---|---|---|
27 | 27 |
from ganeti import utils |
28 | 28 |
from ganeti import compat |
29 | 29 |
from ganeti import vcluster |
30 |
from ganeti import pathutils |
|
30 | 31 |
|
31 | 32 |
import testutils |
32 | 33 |
|
... | ... | |
200 | 201 |
self.assertEqual(vcluster.MakeVirtualPath("/tmp/file", _noderoot=None), |
201 | 202 |
"/tmp/file") |
202 | 203 |
|
204 |
def testWhitelisted(self): |
|
205 |
mvp = vcluster.MakeVirtualPath |
|
206 |
for path in vcluster._VPATH_WHITELIST: |
|
207 |
self.assertEqual(mvp(path), path) |
|
208 |
self.assertEqual(mvp(path, _noderoot=None), path) |
|
209 |
self.assertEqual(mvp(path, _noderoot="/tmp"), path) |
|
210 |
|
|
203 | 211 |
|
204 | 212 |
class TestLocalizeVirtualPath(unittest.TestCase): |
205 | 213 |
def testWrongPrefix(self): |
... | ... | |
225 | 233 |
self.assertEqual(vcluster.LocalizeVirtualPath("/tmp/file", _noderoot=None), |
226 | 234 |
"/tmp/file") |
227 | 235 |
|
236 |
def testWhitelisted(self): |
|
237 |
lvp = vcluster.LocalizeVirtualPath |
|
238 |
for path in vcluster._VPATH_WHITELIST: |
|
239 |
self.assertEqual(lvp(path), path) |
|
240 |
self.assertEqual(lvp(path, _noderoot=None), path) |
|
241 |
self.assertEqual(lvp(path, _noderoot="/tmp"), path) |
|
242 |
|
|
228 | 243 |
|
229 | 244 |
class TestVirtualPathPrefix(unittest.TestCase): |
230 | 245 |
def test(self): |
Also available in: Unified diff