Skip to content

Commit

Permalink
Fixing 3.0 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Oct 17, 2019
1 parent 1d5c244 commit 9a04b38
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from mock import Mock
import imp
from bottle import Response, request, LocalRequest

try:
# python3
from urllib.request import URLError
Expand All @@ -11,6 +12,9 @@
from urllib2 import URLError
import json

from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))

# The validator isn't a module but with a little magic
# we can load it up as if it were in order to access
# the classes within
Expand Down Expand Up @@ -126,15 +130,17 @@ def test06_index_route(self):
def test07_check_manifest3(self):
v = val_mod.Validator()
# good manifests
for good in ('fixtures/3/simple_video.json',
'fixtures/3/full_example.json'):
for good in ['fixtures/3/simple_video.json',
'fixtures/3/full_example.json']:
with open(good, 'r') as fh:
data = fh.read()
j = json.loads(v.check_manifest(data, '3.0'))
self.assertEqual(j['okay'], 1)
for bad_data in ('fixtures/3/broken_simple_image.json'):
with open(good, 'r') as fh:
for bad_data in ['fixtures/3/broken_simple_image.json']:
with open(bad_data, 'r') as fh:
data = fh.read()
j = json.loads(v.check_manifest(data, '3.0'))
self.assertEqual(j['okay'], 0)

if __name__ == '__main__':
unittest.main()

0 comments on commit 9a04b38

Please sign in to comment.