MCPcopy Create free account
hub / github.com/numpy/numpy / test_sandboxing

Method test_sandboxing

numpy/lib/tests/test__datasource.py:226–238  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

224 assert_(invalidfile != self.ds.abspath(tmpfile))
225
226 def test_sandboxing(self):
227 tmpfile = valid_textfile(self.tmpdir)
228 tmpfilename = os.path.split(tmpfile)[-1]
229
230 tmp_path = lambda x: os.path.abspath(self.ds.abspath(x))
231
232 assert_(tmp_path(valid_httpurl()).startswith(self.tmpdir))
233 assert_(tmp_path(invalid_httpurl()).startswith(self.tmpdir))
234 assert_(tmp_path(tmpfile).startswith(self.tmpdir))
235 assert_(tmp_path(tmpfilename).startswith(self.tmpdir))
236 for fn in malicious_files:
237 assert_(tmp_path(http_path+fn).startswith(self.tmpdir))
238 assert_(tmp_path(fn).startswith(self.tmpdir))
239
240 def test_windows_os_sep(self):
241 orig_os_sep = os.sep

Callers 1

test_windows_os_sepMethod · 0.95

Calls 7

assert_Function · 0.90
valid_textfileFunction · 0.85
valid_httpurlFunction · 0.85
invalid_httpurlFunction · 0.85
startswithMethod · 0.80
splitMethod · 0.45
abspathMethod · 0.45

Tested by

no test coverage detected