<commit_before># -*- coding: utf-8 -*-

import httpretty
import json
import nose
import os

import ckantoolkit.tests.helpers as h

import ckanext.harvest.model as harvest_model
from ckanext.harvest import queue

from ckanext.geocat.metadata import CswHelper
from ckanext.geocat.csw_processor import GeocatCatalogueServiceWeb


eq_ = nose.tools.eq_
assert_true = nose.tools.assert_true
assert_raises = nose.tools.assert_raises

__location__ = os.path.realpath(
    os.path.join(
        os.getcwd(),
        os.path.dirname(__file__)
    )
)

mock_url = "http://mock-geocat.ch"

# Monkey patch required because of a bug between httpretty and redis.
# See https://github.com/gabrielfalcao/HTTPretty/issues/113

original_get_geocat_id_from_csw = GeocatCatalogueServiceWeb.get_geocat_id_from_csw

def _patched_get_geocat_id_from_csw(self):

    httpretty.enable()

    ids = original_get_geocat_id_from_csw(self)<commit_msg>fix: Fix imports in test<commit_after># -*- coding: utf-8 -*-

import httpretty
import json
import nose
import os

import ckantoolkit.tests.helpers as h

import ckanext.harvest.model as harvest_model
from ckanext.harvest import queue

from ckanext.geocat.utils.csw_processor import GeocatCatalogueServiceWeb


eq_ = nose.tools.eq_
assert_true = nose.tools.assert_true
assert_raises = nose.tools.assert_raises

__location__ = os.path.realpath(
    os.path.join(
        os.getcwd(),
        os.path.dirname(__file__)
    )
)

mock_url = "http://mock-geocat.ch"

# Monkey patch required because of a bug between httpretty and redis.
# See https://github.com/gabrielfalcao/HTTPretty/issues/113

original_get_geocat_id_from_csw = GeocatCatalogueServiceWeb.get_geocat_id_from_csw

def _patched_get_geocat_id_from_csw(self):

    httpretty.enable()

    ids = original_get_geocat_id_from_csw(self)
{'fraction_non_alphanumeric': 0.08503589177250138, 'fraction_numerical': 0.004417448923246825, 'mean_word_length': 4.592592592592593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2256613', 'n_tokens_mistral': 679, 'n_tokens_neox': 674, 'n_words': 127}