Repository: zimeon/ocfl-py

Issue:
Fix validation error for forward slash in `contentDirectory`
From https://github.com/OCFL/fixtures/pull/82 the error for this should be `E017` instead of `E018`

Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/38973210/badge)](https://coveralls.io/builds/38973210)

Coverage increased (+0.01%) to 94.517% when pulling **f8da8d6784604ec1a5ef129a0055d08be8a4e589 on issue-53** into **2c11ca2c8df09bd33eb18f4fc3de1b879826526b on develop**.


Patch:
diff --git a/ocfl/data/validation-errors.json b/ocfl/data/validation-errors.json
index 1f53481..b3b07ff 100644
--- a/ocfl/data/validation-errors.json
+++ b/ocfl/data/validation-errors.json
@@ -86,9 +86,16 @@
        "en": "OCFL Object version directory %s includes an illegal file (%s)"
     }
   },
+  "E017": {
+    "params": ["where"],
+    "description": {
+       "en": "OCFL Object %s inventory contentDirectory must be a string and must not contain a forward slash (/)"
+    }
+  },
   "E018": {
+    "params": ["where"],
     "description": {
-       "en": "Content directory must not contain a forward slash (/) or be . or .."
+       "en": "OCFL Object %s inventory contentDirectory must not be either . or .."
     }
   },
   "E023": {
diff --git a/ocfl/inventory_validator.py b/ocfl/inventory_validator.py
index 44a15b4..021798b 100644
--- a/ocfl/inventory_validator.py
+++ b/ocfl/inventory_validator.py
@@ -79,7 +79,9 @@ class InventoryValidator():
         if 'contentDirectory' in inventory:
             # Careful only to set self.content_directory if value is safe
             cd = inventory['contentDirectory']
-            if not isinstance(cd, str) or '/' in cd or cd in ['.', '..']:
+            if not isinstance(cd, str) or '/' in cd:
+                self.error("E017")
+            elif cd in ('.', '..'):
                 self.error("E018")
             else:
                 self.content_directory = cd


Test patch:
diff --git a/tests/test_inventory_validator.py b/tests/test_inventory_validator.py
index bc87693..1551ca1 100644
--- a/tests/test_inventory_validator.py
+++ b/tests/test_inventory_validator.py
@@ -66,7 +66,10 @@ class TestAll(unittest.TestCase):
         iv = InventoryValidator(log=log)
         log.clear()
         iv.validate({"id": "like:uri", "contentDirectory": "not/allowed"})
-        self.assertIn('E018', log.errors)
+        self.assertIn('E017', log.errors)
+        log.clear()
+        iv.validate({"id": "like:uri", "contentDirectory": ["s"]})
+        self.assertIn('E017', log.errors)
         log.clear()
         iv.validate({"id": "like:uri", "contentDirectory": ".."})
         self.assertIn('E018', log.errors)