<commit_before>from twisted.trial.unittest import TestCase
from crypto_finance.sync import auth
from mock import patch


class AuthTestCase(TestCase):

    @patch('leap.auth.SRPAuth', autospec=True)
    def test_authorize_calls(self, fake_srp):
        auth.SRPAuth = fake_srp
        auth.authenticate('user', '<PASSWORD>',
                          'ca.crt', 'api')
        fake_srp.assert_called_once_with('api', 'ca.crt')
        instance = fake_srp.return_value
        instance.authenticate.assert_called_once_with('user', 'pass')<commit_msg>[tests] configurable function to use on Auth resource<commit_after>from twisted.trial.unittest import TestCase
from crypto_finance.sync import auth
from mock import patch
from mock import Mock


class AuthTestCase(TestCase):

    @patch('leap.auth.SRPAuth', autospec=True)
    def test_authorize_calls(self, fake_srp):
        auth.SRPAuth = fake_srp
        auth.authenticate('user', 'pass',
                          'ca.crt', 'api')
        fake_srp.assert_called_once_with('api', 'ca.crt')
        instance = fake_srp.return_value
        instance.authenticate.assert_called_once_with('user', 'pass')

    def test_configured_authenticator(self):
        auth.authenticate = Mock()
        authenticator = auth.configure_authenticator('ca.crt', 'api')

        authenticator('user', 'pass')

        auth.authenticate.assert_called_once_with('user', 'pass',
                                                  cert_file='ca.crt',
                                                  api='api')
{'fraction_non_alphanumeric': 0.10649350649350649, 'fraction_numerical': 0.0, 'mean_word_length': 2.704326923076923, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7299275', 'n_tokens_mistral': 459, 'n_tokens_neox': 443, 'n_words': 85}