<commit_before># coding: utf-8
from __future__ import absolute_import, unicode_literals

from cryptography.hazmat.backends.openssl.rsa import _RSAPrivateKey, _RSAPublicKey
from django.test import TestCase
from django.utils import six
from jwt.exceptions import InvalidKeyError

from rest_framework_sso import keys


class TestReadKeyFile(TestCase):
    def test_read(self):
        key_data = keys.read_key_file('test-2048.pem')
        self.assertIsInstance(key_data, six.binary_type)
        key_data_lines = key_data.decode('utf-8').split('\n')
        self.assertIn('-----BEGIN PRIVATE KEY-----', key_data_lines)
        self.assertIn('-----END PRIVATE KEY-----', key_data_lines)
        self.assertIn('-----BEGIN PUBLIC KEY-----', key_data_lines)
        self.assertIn('-----END PUBLIC KEY-----', key_data_lines)


class TestGetKeyId(TestCase):
    def test_root_simple(self):<commit_msg>Replace django six package with the python one.<commit_after># coding: utf-8
from __future__ import absolute_import, unicode_literals
import six

from cryptography.hazmat.backends.openssl.rsa import _RSAPrivateKey, _RSAPublicKey
from django.test import TestCase
from jwt.exceptions import InvalidKeyError

from rest_framework_sso import keys


class TestReadKeyFile(TestCase):
    def test_read(self):
        key_data = keys.read_key_file('test-2048.pem')
        self.assertIsInstance(key_data, six.binary_type)
        key_data_lines = key_data.decode('utf-8').split('\n')
        self.assertIn('-----BEGIN PRIVATE KEY-----', key_data_lines)
        self.assertIn('-----END PRIVATE KEY-----', key_data_lines)
        self.assertIn('-----BEGIN PUBLIC KEY-----', key_data_lines)
        self.assertIn('-----END PUBLIC KEY-----', key_data_lines)


class TestGetKeyId(TestCase):
    def test_root_simple(self):
{'fraction_non_alphanumeric': 0.12985571587125416, 'fraction_numerical': 0.006659267480577136, 'mean_word_length': 3.6469072164948453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '7106210', 'n_tokens_mistral': 580, 'n_tokens_neox': 553, 'n_words': 122}