<commit_before># -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# See license.txt
from __future__ import unicode_literals

import unittest
import frappe

test_dependencies = ['User', 'Connected App', 'Token Cache']

class TestTokenCache(unittest.TestCase):

	def setup(self):
		token_cache_list = frappe.get_list('Token Cache')
		connected_app_list = frappe.get_list('Connected App')
		self.token_cache = frappe.get_doc('Token Cache', token_cache_list[0].name)
		self.token_cache.update({'connected_app': connected_app_list[0].name})

	def test_get_auth_header(self):
		self.token_cache.get_auth_header()

	def test_update_data(self):
		self.token_cache.update_data({
			'access_token': '<PASSWORD>-token',
			'refresh_token': '<PASSWORD>',
			'token_type': 'bearer',
			'expires_in': 2000,<commit_msg>test: fix TestTokenCache.setUp()<commit_after># -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# See license.txt
from __future__ import unicode_literals

import unittest
import frappe

test_dependencies = ['User', 'Connected App', 'Token Cache']

class TestTokenCache(unittest.TestCase):

	def setUp(self):
		self.token_cache = frappe.get_last_doc('Token Cache')
		self.token_cache.update({'connected_app': frappe.get_last_doc('Connected App').name})
		self.token_cache.save()

	def test_get_auth_header(self):
		self.token_cache.get_auth_header()

	def test_update_data(self):
		self.token_cache.update_data({
			'access_token': '<PASSWORD>-access-token',
			'refresh_token': '<PASSWORD>-token',
			'token_type': 'bearer',
			'expires_in': 2000,
{'fraction_non_alphanumeric': 0.13675742574257427, 'fraction_numerical': 0.012376237623762377, 'mean_word_length': 6.06113537117904, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4330745', 'n_tokens_mistral': 597, 'n_tokens_neox': 546, 'n_words': 108}