# Path: tests/support/factories/core_files.py
# TEST_FILE_RESPONSES = {}
# 
# Path: tests/support/constants.py
# BAD_DATAJSON_URL = "http://104.131.35.253/data.json"
# 
# BAD_DATAJSON_URL2 = "http://181.209.63.71/data.json"
# 
# Path: tests/support/utils.py
# def jsonschema_str(string):
#     return repr(string)
# 
# Path: tests/context.py

# 
# Path: tests/support/decorators.py
# RESULTS_DIR = os.path.join("tests", "results")


import json
import os.path
import re
import requests_mock
import vcr
    import mock
import io
from nose.tools import assert_true, assert_false, assert_dict_equal, \
    assert_regexp_matches
from six import iteritems, text_type
from tests.support.factories.core_files import TEST_FILE_RESPONSES
from .support.constants import BAD_DATAJSON_URL, BAD_DATAJSON_URL2
from .support.utils import jsonschema_str
    from unittest import mock
from .context import pydatajson
from .support.decorators import RESULTS_DIR
            response = response[key]

        p = re.compile(regex)
        matches = [p.match(error['message']) for error in response]
        assert_true(any(matches))

    @my_vcr.use_cassette('test_validate_bad_remote_datajson')
    def test_validate_invalid_remote_datajson_is_invalid(self):
        """ Testea `is_valid_catalog` contra un data.json remoto invalido."""

        res = self.dj.is_valid_catalog(BAD_DATAJSON_URL)
        assert_false(res)

    def test_validate_invalid_remote_datajson_has_errors(self):
        """ Testea `validate_catalog` contra un data.json remoto invalido."""

        errors = [(
                    ['error', 'catalog', 'errors', ],
                    "%s is too short" % jsonschema_str('')
                   )]
        for path, regex in errors:
            with my_vcr.use_cassette('test_validate_bad_remote_datajson'):
                yield self.validate_contains_message, BAD_DATAJSON_URL,\
                      path, regex

    # Tests contra una URL REMOTA
    @my_vcr.use_cassette('test_validate_bad_remote_datajson2')
    def test_validate_invalid_remote_datajson_is_invalid2(self):
        """ Testea `is_valid_catalog` contra un data.json remoto invalido."""


# Path: tests/support/factories/core_files.py
# TEST_FILE_RESPONSES = {}
# 
# Path: tests/support/constants.py
# BAD_DATAJSON_URL = "http://104.131.35.253/data.json"
# 
# BAD_DATAJSON_URL2 = "http://181.209.63.71/data.json"
# 
# Path: tests/support/utils.py
# def jsonschema_str(string):
#     return repr(string)
# 
# Path: tests/context.py

# 
# Path: tests/support/decorators.py
# RESULTS_DIR = os.path.join("tests", "results")


# Path: tests/test_validation.py
import json
import os.path
import re
import requests_mock
import vcr
    import mock
import io
from nose.tools import assert_true, assert_false, assert_dict_equal, \
    assert_regexp_matches
from six import iteritems, text_type
from tests.support.factories.core_files import TEST_FILE_RESPONSES
from .support.constants import BAD_DATAJSON_URL, BAD_DATAJSON_URL2
from .support.utils import jsonschema_str
    from unittest import mock
from .context import pydatajson
from .support.decorators import RESULTS_DIR

            response = response[key]

        p = re.compile(regex)
        matches = [p.match(error['message']) for error in response]
        assert_true(any(matches))

    @my_vcr.use_cassette('test_validate_bad_remote_datajson')
    def test_validate_invalid_remote_datajson_is_invalid(self):
        """ Testea `is_valid_catalog` contra un data.json remoto invalido."""

        res = self.dj.is_valid_catalog(BAD_DATAJSON_URL)
        assert_false(res)

    def test_validate_invalid_remote_datajson_has_errors(self):
        """ Testea `validate_catalog` contra un data.json remoto invalido."""

        errors = [(
                    ['error', 'catalog', 'errors', ],
                    "%s is too short" % jsonschema_str('')
                   )]
        for path, regex in errors:
            with my_vcr.use_cassette('test_validate_bad_remote_datajson'):
                yield self.validate_contains_message, BAD_DATAJSON_URL,\
                      path, regex

    # Tests contra una URL REMOTA
    @my_vcr.use_cassette('test_validate_bad_remote_datajson2')
    def test_validate_invalid_remote_datajson_is_invalid2(self):
        """ Testea `is_valid_catalog` contra un data.json remoto invalido."""


        res = self.dj.is_valid_catalog(BAD_DATAJSON_URL2)