<commit_before>import unittest
import mock
from ..connection import Connection


class TestConnection(unittest.TestCase):

    @mock.patch('auth0.v2.connection.RestClient')
    def test_all(self, mock_rc):
        mock_instance = mock_rc.return_value
        mock_instance.get.return_value = {}

        c = Connection(domain='domain', jwt_token='<PASSWORD>')
        c.all()

        args, kwargs = mock_instance.get.call_args

        self.assertEqual('https://domain/api/v2/connections', args[0])
        self.assertEqual(kwargs['params'], {'fields': None,
                                            'strategy': None,
                                            'include_fields': 'true'})

        c.all(fields=['a', 'b'], include_fields=False)

        args, kwargs = mock_instance.get.call_args

        self.assertEqual('https://domain/api/v2/connections', args[0])
        self.assertEqual(kwargs['params'], {'fields': 'a,b',
                                            'strategy': None,
                                            'include_fields': 'false'})

        c.all(fields=['a', 'b'], strategy='strategy', include_fields=True)

        args, kwargs = mock_instance.get.call_args

        self.assertEqual('https://domain/api/v2/connections', args[0])
        self.assertEqual(kwargs['params'], {'fields': 'a,b',
                                            'strategy': 'strategy',
                                            'include_fields': 'true'})<commit_msg>Add test_get() test case<commit_after>import unittest
import mock
from ..connection import Connection


class TestConnection(unittest.TestCase):

    @mock.patch('auth0.v2.connection.RestClient')
    def test_all(self, mock_rc):
        mock_instance = mock_rc.return_value
        mock_instance.get.return_value = {}

        c = Connection(domain='domain', jwt_token='<PASSWORD>')
        c.all()

        args, kwargs = mock_instance.get.call_args

        self.assertEqual('https://domain/api/v2/connections', args[0])
        self.assertEqual(kwargs['params'], {'fields': None,
                                            'strategy': None,
                                            'include_fields': 'true'})

        c.all(fields=['a', 'b'], include_fields=False)

        args, kwargs = mock_instance.get.call_args

        self.assertEqual('https://domain/api/v2/connections', args[0])
        self.assertEqual(kwargs['params'], {'fields': 'a,b',
                                            'strategy': None,
                                            'include_fields': 'false'})

        c.all(fields=['a', 'b'], strategy='strategy', include_fields=True)

        args, kwargs = mock_instance.get.call_args

        self.assertEqual('https://domain/api/v2/connections', args[0])
        self.assertEqual(kwargs['params'], {'fields': 'a,b',
                                            'strategy': 'strategy',
                                            'include_fields': 'true'})

    @mock.patch('auth0.v2.connection.RestClient')
    def test_get(self, mock_rc):
        mock_instance = mock_rc.return_value
        mock_instance.get.return_value = {}

        c = Connection(domain='domain', jwt_token='<PASSWORD>')
        c.get('an-id')

        args, kwargs = mock_instance.get.call_args
        self.assertEqual('https://domain/api/v2/connections/an-id', args[0])
        self.assertEqual(kwargs['params'], {'fields': None,
                                            'include_fields': 'true'})

        c.get('an-id', fields=['a', 'b'])

        args, kwargs = mock_instance.get.call_args
        self.assertEqual('https://domain/api/v2/connections/an-id', args[0])
        self.assertEqual(kwargs['params'], {'fields': 'a,b',
                                            'include_fields': 'true'})

        c.get('an-id', fields=['a', 'b'], include_fields=False)

        args, kwargs = mock_instance.get.call_args
        self.assertEqual('https://domain/api/v2/connections/an-id', args[0])
        self.assertEqual(kwargs['params'], {'fields': 'a,b',
                                            'include_fields': 'false'})
{'fraction_non_alphanumeric': 0.1468090269352099, 'fraction_numerical': 0.005823829167677748, 'mean_word_length': 1.9442857142857144, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3497056', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1087, 'n_words': 178}