<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
test_koordinates
----------------------------------

Tests for `koordinates` module.

:copyright: (c) 2015 by Koordinates .
:license: BSD, see LICENSE for more details.
"
"""
#from __future__ import unicode_literals
#from __future__ import absolute_import

import sys
import os
import unittest
import uuid

import responses
import requests

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import koordinates

sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
from canned_responses_for_tests import layers_multiple_good_simulated_response
#from canned_responses_for_tests import layers_single_good_simulated_response

def getpass():
    '''
    Prompt user for Password until there is a Connection object
    '''
    import getpass
    return(getpass.getpass('Please enter your Koordinates password: '))


class TestKoordinates(unittest.TestCase):

    pwd = getpass()


    def setUp(self):
        self.koordconn = koordinates.api.Connection('<EMAIL>', TestKoordinates.pwd)
        invalid_password = str(uuid.uuid1())
        self.bad_koordconn = koordinates.api.Connection('<EMAIL>', invalid_password)

    def test_layers_url_template(self):
        L = koordinates.api.Layer(self.koordconn, 999)
        assert L.url('GET', 'single') == '''https://koordinates.com/services/api/v1/layers/999/'''


    def test_layers_url_template(self):
        L = koordinates.api.Layer(self.koordconn, 999)
        assert L.url_templates('GET', 'single') == '''https://koordinates.com/services/api/v1/layers/{layer_id}/'''<commit_msg>Avoid password prompt hanging tests in CircleCI<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
test_koordinates
----------------------------------

Tests for `koordinates` module.

:copyright: (c) 2015 by Koordinates .
:license: BSD, see LICENSE for more details.
"
"""
#from __future__ import unicode_literals
#from __future__ import absolute_import

import sys
import os
import unittest
import uuid

import responses
import requests

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import koordinates

sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
from canned_responses_for_tests import layers_multiple_good_simulated_response
#from canned_responses_for_tests import layers_single_good_simulated_response

def getpass():
    '''
    Prompt user for Password until there is a Connection object
    '''
    import getpass
    if ('CIRCLECI' in os.environ) and ('KPWD' in os.environ):
        return os.environ['KPWD']
    else:
        return(getpass.getpass('Please enter your Koordinates password: '))


class TestKoordinates(unittest.TestCase):

    pwd = getpass()


    def setUp(self):
        self.koordconn = koordinates.api.Connection('<EMAIL>', TestKoordinates.pwd)
        invalid_password = str(uuid.uuid1())
        self.bad_koordconn = koordinates.api.Connection('<EMAIL>', invalid_password)

    def test_layers_url_template(self):
        L = koordinates.api.Layer(self.koordconn, 999)
        assert L.url('GET', 'single') == '''https://koordinates.com/services/api/v1/layers/999/'''


    def test_layers_url_template(self):
        L = koordinates.api.Layer(self.koordconn, 999)
        assert L.url_templates('GET', 'single') == '''https://koordinates.com/services/api/v1/layers/{layer_id}/'''
{'fraction_non_alphanumeric': 0.1447602131438721, 'fraction_numerical': 0.010065127294256957, 'mean_word_length': 3.847919655667145, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '1651049', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1057, 'n_words': 224}