Browse Source

cover a couple missed cases for _archive..

hide coverage in test code
main
John-Mark Gurney 2 years ago
parent
commit
e51b7a62ac
3 changed files with 15 additions and 3 deletions
  1. +11
    -2
      ui/fixtures/cmd.container.tar.json
  2. BIN
      ui/fixtures/testfile.tar.gz
  3. +4
    -1
      ui/medashare/cli.py

+ 11
- 2
ui/fixtures/cmd.container.tar.json View File

@@ -24,8 +24,17 @@
{ "files": [ "testfiles/newfile.txt", "testfiles/test.txt" ], { "files": [ "testfiles/newfile.txt", "testfiles/test.txt" ],
"hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c", "sha512:7d5768d47b6bc27dc4fa7e9732cfa2de506ca262a2749cb108923e5dddffde842bbfee6cb8d692fb43aca0f12946c521cce2633887914ca1f96898478d10ad3f" ], "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c", "sha512:7d5768d47b6bc27dc4fa7e9732cfa2de506ca262a2749cb108923e5dddffde842bbfee6cb8d692fb43aca0f12946c521cce2633887914ca1f96898478d10ad3f" ],
"type": "container", "type": "container",
"uri": "hash://sha512/79fab684ca73e25994c1b739dcf8f03acf27dff74d63b4b3affd9aa69fbb37d23794b723802cad131969225403846f8f8c470bc2432c32de34d39f044a360073" },
{ "type": "file", "hashes": [ "sha512:79fab684ca73e25994c1b739dcf8f03acf27dff74d63b4b3affd9aa69fbb37d23794b723802cad131969225403846f8f8c470bc2432c32de34d39f044a360073" ] }
"uri": "hash://sha512/80b8615104d04870ca23a0df0b63097a84a05fabf0813ced03482f742402d8c06598e32dc080e584935c4901d424c9d08d987040e3f49ef11732af5c8bf6e2aa" },
{ "type": "file", "hashes": [ "sha512:80b8615104d04870ca23a0df0b63097a84a05fabf0813ced03482f742402d8c06598e32dc080e584935c4901d424c9d08d987040e3f49ef11732af5c8bf6e2aa" ] }
] ]
},
{
"title": "import tar.gz container",
"cmd": [ "container", "testfile.tar.gz" ]
},
{
"special": "verify store object cnt",
"comment": "should have one container and one file",
"count": 2
} }
] ]

BIN
ui/fixtures/testfile.tar.gz View File


+ 4
- 1
ui/medashare/cli.py View File

@@ -710,6 +710,7 @@ class FileObject(MDBase):
mode = mode & ~nbit mode = mode & ~nbit


return '|'.join(r) return '|'.join(r)

@classmethod @classmethod
def _real_stat_repr(cls, st): # pragma: no cover def _real_stat_repr(cls, st): # pragma: no cover
return 'os.stat_result' \ return 'os.stat_result' \
@@ -1779,6 +1780,7 @@ class _TestCases(unittest.TestCase):
# repr on os.stat_result doesn't work # repr on os.stat_result doesn't work
# (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) # (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)


'f': os.stat_result((stat.S_IROTH|stat.S_IXOTH|stat.S_IRGRP|stat.S_IXGRP|stat.S_IXUSR|stat.S_IRUSR|stat.S_IFDIR, 10, 100, 2, 100, 100, 1024, 1654166365, 1558388856.000000, 1663133775)),
'test.txt': os.stat_result((stat.S_IROTH|stat.S_IRGRP|stat.S_IWUSR|stat.S_IRUSR|stat.S_IFREG, 10, 100, 1, 100, 100, 15, 1654166365, 1558388856.000000, 1663133775)), 'test.txt': os.stat_result((stat.S_IROTH|stat.S_IRGRP|stat.S_IWUSR|stat.S_IRUSR|stat.S_IFREG, 10, 100, 1, 100, 100, 15, 1654166365, 1558388856.000000, 1663133775)),
'newfile.txt': os.stat_result((stat.S_IROTH|stat.S_IRGRP|stat.S_IWUSR|stat.S_IRUSR|stat.S_IFREG, 10, 100, 1, 100, 100, 19, 1659652579, 1658982768.041291, 1663133775)), 'newfile.txt': os.stat_result((stat.S_IROTH|stat.S_IRGRP|stat.S_IWUSR|stat.S_IRUSR|stat.S_IFREG, 10, 100, 1, 100, 100, 19, 1659652579, 1658982768.041291, 1663133775)),
'sample.data.sqlite3': os.stat_result((stat.S_IROTH|stat.S_IRGRP|stat.S_IWUSR|stat.S_IRUSR|stat.S_IFREG, 10, 100, 1, 100, 100, 57344, 1663133777, 1663133777.529757, 1663133777)), 'sample.data.sqlite3': os.stat_result((stat.S_IROTH|stat.S_IRGRP|stat.S_IWUSR|stat.S_IRUSR|stat.S_IFREG, 10, 100, 1, 100, 100, 57344, 1663133777, 1663133777.529757, 1663133777)),
@@ -2386,7 +2388,8 @@ class _TestCases(unittest.TestCase):
return orig_open(fname, mode) return orig_open(fname, mode)


#print('foo:', repr(fname), repr(mode), file=sys.stderr) #print('foo:', repr(fname), repr(mode), file=sys.stderr)
raise FileNotFoundError
if True: #pragma: no cover
raise FileNotFoundError


op.side_effect = open_repl op.side_effect = open_repl




Loading…
Cancel
Save