@@ -21,7 +21,7 @@ def assertRegex(self, *args, **kwargs):
2121 """Hack for Python 2.7."""
2222 return self .assertRegexpMatches (* args , ** kwargs )
2323
24- def test01_init (self ):
24+ def test00_init (self ):
2525 """Test Object init."""
2626 oo = Object ()
2727 self .assertEqual (oo .id , None )
@@ -33,6 +33,14 @@ def test01_init(self):
3333 self .assertEqual (oo .digest_algorithm , 'sha1' )
3434 self .assertEqual (oo .fixity , ['md5' , 'crc16' ])
3535
36+ def test01_open_fs (self ):
37+ """Test open_fs."""
38+ oo = Object ()
39+ self .assertEqual (oo .obj_fs , None )
40+ oo .open_fs ('tests' )
41+ self .assertNotEqual (oo .obj_fs , None )
42+ self .assertRaises (ObjectException , oo .open_fs , 'tests/testdata/i_do_not_exist' )
43+
3644 def test02_parse_version_directory (self ):
3745 """Test parse_version_directory."""
3846 oo = Object ()
@@ -304,7 +312,7 @@ def test12_show(self):
304312 self .assertTrue ('├── 0=ocfl_object_1.0' in out )
305313 # FIXME - need real tests in here when there is real output
306314
307- def test13_validate (self ):
315+ def test_validate (self ):
308316 """Test validate method."""
309317 oo = Object ()
310318 self .assertTrue (oo .validate (objdir = 'fixtures/1.0/good-objects/minimal_one_version_one_file' ))
@@ -313,7 +321,16 @@ def test13_validate(self):
313321 self .assertFalse (oo .validate (objdir = 'fixtures/1.0/bad-objects/E001_no_decl' ))
314322 self .assertFalse (oo .validate (objdir = 'fixtures/1.0/bad-objects/E036_no_id' ))
315323
316- def test14_parse_inventory (self ):
324+ def test_validate_inventory (self ):
325+ """Test validate_inventory method."""
326+ oo = Object ()
327+ self .assertTrue (oo .validate_inventory (path = 'fixtures/1.0/good-objects/minimal_one_version_one_file/inventory.json' ))
328+ # Error cases
329+ self .assertFalse (oo .validate_inventory (path = 'tests/testdata/i_do_not_exist' ))
330+ self .assertFalse (oo .validate_inventory (path = 'fixtures/1.0/bad-objects/E036_no_id/inventory.json' ))
331+ self .assertFalse (oo .validate_inventory (path = 'tests/testdata//namaste/0=frog' )) # not JSON
332+
333+ def test_parse_inventory (self ):
317334 """Test parse_inventory method."""
318335 oo = Object ()
319336 oo .open_fs ('fixtures/1.0/good-objects/minimal_one_version_one_file' )
@@ -336,7 +353,7 @@ def test14_parse_inventory(self):
336353 oo .open_fs ('fixtures/1.0/bad-objects/E036_no_id' )
337354 self .assertRaises (ObjectException , oo .parse_inventory )
338355
339- def test15_map_filepath (self ):
356+ def test_map_filepath (self ):
340357 """Test map_filepath method."""
341358 oo = Object ()
342359 # default is uri
@@ -353,7 +370,7 @@ def test15_map_filepath(self):
353370 oo .filepath_normalization = '???'
354371 self .assertRaises (Exception , oo .map_filepath , 'a' , 'v1' , {})
355372
356- def test16_extract (self ):
373+ def test_extract (self ):
357374 """Test extract method."""
358375 tempdir = tempfile .mkdtemp (prefix = 'test_extract' )
359376 oo = Object ()
0 commit comments