# Path: tests/context.py

# 
# Path: pydatajson/helpers.py
# def is_local_andino_resource(catalog, distribution):
#     dist_type = distribution.get('type')
#     if dist_type is not None:
#         return dist_type == 'file.upload'
#     homepage = catalog.get('homepage')
#     if homepage is not None:
#         return distribution.get('downloadURL', '').startswith(homepage)
#     return False


import unittest
import os
import re
import json
    from mock import patch, MagicMock, ANY
    from unittest.mock import patch, MagicMock, ANY
from .context import pydatajson
from pydatajson.federation import *
from pydatajson.helpers import is_local_andino_resource
from ckanapi.errors import NotFound, CKANAPIError
# -*- coding: utf-8 -*-

from __future__ import unicode_literals


try:
except ImportError:


SAMPLES_DIR = os.path.join("tests", "samples")


class FederationSuite(unittest.TestCase):
    @classmethod
    def get_sample(cls, sample_filename):
        return os.path.join(SAMPLES_DIR, sample_filename)


@patch('pydatajson.federation.RemoteCKAN')
class PushDatasetTestCase(FederationSuite):

    @classmethod
    def setUpClass(cls):

# Path: tests/context.py

# 
# Path: pydatajson/helpers.py
# def is_local_andino_resource(catalog, distribution):
#     dist_type = distribution.get('type')
#     if dist_type is not None:
#         return dist_type == 'file.upload'
#     homepage = catalog.get('homepage')
#     if homepage is not None:
#         return distribution.get('downloadURL', '').startswith(homepage)
#     return False


# Path: tests/test_federation.py
import unittest
import os
import re
import json
    from mock import patch, MagicMock, ANY
    from unittest.mock import patch, MagicMock, ANY
from .context import pydatajson
from pydatajson.federation import *
from pydatajson.helpers import is_local_andino_resource
from ckanapi.errors import NotFound, CKANAPIError

# -*- coding: utf-8 -*-

from __future__ import unicode_literals


try:
except ImportError:


SAMPLES_DIR = os.path.join("tests", "samples")


class FederationSuite(unittest.TestCase):
    @classmethod
    def get_sample(cls, sample_filename):
        return os.path.join(SAMPLES_DIR, sample_filename)


@patch('pydatajson.federation.RemoteCKAN')
class PushDatasetTestCase(FederationSuite):

    @classmethod
    def setUpClass(cls):

        cls.catalog = pydatajson.DataJson(cls.get_sample('full_data.json'))