# Path: onedrived/od_api_session.py
# def get_keyring_key(account_id):
#     def expires_in_sec(self):
#     def save_session(self, **save_session_kwargs):
#     def load_session(**load_session_kwargs):
# class OneDriveAPISession(onedrivesdk.session.Session):
#     SESSION_ARG_KEYNAME = 'key'
#     KEYRING_SERVICE_NAME = 'onedrived_v2'
#     KEYRING_ACCOUNT_KEY_PREFIX = 'user.'
#     PICKLE_PROTOCOL = 3
# 
# Path: onedrived/od_auth.py
# def get_authenticator_and_drives(context, account_id):
#     def __init__(self):
#     def get_auth_url(self):
#     def authenticate(self, code):
#     def get_profile(self, user_id='me'):
#     def session_expires_in_sec(self):
#     def refresh_session(self, account_id):
#     def save_session(self, key):
#     def load_session(self, key):
# class AccountTypes:
# class OneDriveAuthenticator:
#     PERSONAL = 0
#     BUSINESS = 1
#     ACCOUNT_TYPE = AccountTypes.PERSONAL
#     APP_CLIENT_ID = '000000004010C916'
#     APP_CLIENT_SECRET = 'PimIrUibJfsKsMcd0SqwPBwMTV7NDgYi'
#     APP_BASE_URL = 'https://api.onedrive.com/v1.0/'
#     APP_REDIRECT_URL = 'https://login.live.com/oauth20_desktop.srf'
#     APP_SCOPES = ['wl.signin', 'wl.emails', 'wl.offline_access', 'onedrive.readwrite']


import unittest
import keyring
from onedrived import od_api_session, od_auth




class OneDriveAPISession(unittest.TestCase):

    def setUp(self):
        self.session = od_api_session.OneDriveAPISession(
            token_type='code', expires_in=100, scope_string=' '.join(od_auth.OneDriveAuthenticator.APP_SCOPES),
            access_token='abc', client_id='client_id', auth_server_url='https://foo/bar', redirect_uri='https://baz',
            refresh_token='hehe', client_secret='no_secret')

    def test_expires_in(self):
        self.assertLess(self.session.expires_in_sec, 100)

    def test_save_and_load(self):
        keydict = {self.session.SESSION_ARG_KEYNAME: 'mock_key'}
        self.session.save_session(**keydict)

# Path: onedrived/od_api_session.py
# def get_keyring_key(account_id):
#     def expires_in_sec(self):
#     def save_session(self, **save_session_kwargs):
#     def load_session(**load_session_kwargs):
# class OneDriveAPISession(onedrivesdk.session.Session):
#     SESSION_ARG_KEYNAME = 'key'
#     KEYRING_SERVICE_NAME = 'onedrived_v2'
#     KEYRING_ACCOUNT_KEY_PREFIX = 'user.'
#     PICKLE_PROTOCOL = 3
# 
# Path: onedrived/od_auth.py
# def get_authenticator_and_drives(context, account_id):
#     def __init__(self):
#     def get_auth_url(self):
#     def authenticate(self, code):
#     def get_profile(self, user_id='me'):
#     def session_expires_in_sec(self):
#     def refresh_session(self, account_id):
#     def save_session(self, key):
#     def load_session(self, key):
# class AccountTypes:
# class OneDriveAuthenticator:
#     PERSONAL = 0
#     BUSINESS = 1
#     ACCOUNT_TYPE = AccountTypes.PERSONAL
#     APP_CLIENT_ID = '000000004010C916'
#     APP_CLIENT_SECRET = 'PimIrUibJfsKsMcd0SqwPBwMTV7NDgYi'
#     APP_BASE_URL = 'https://api.onedrive.com/v1.0/'
#     APP_REDIRECT_URL = 'https://login.live.com/oauth20_desktop.srf'
#     APP_SCOPES = ['wl.signin', 'wl.emails', 'wl.offline_access', 'onedrive.readwrite']


# Path: tests/test_api_session.py
import unittest
import keyring
from onedrived import od_api_session, od_auth





class OneDriveAPISession(unittest.TestCase):

    def setUp(self):
        self.session = od_api_session.OneDriveAPISession(
            token_type='code', expires_in=100, scope_string=' '.join(od_auth.OneDriveAuthenticator.APP_SCOPES),
            access_token='abc', client_id='client_id', auth_server_url='https://foo/bar', redirect_uri='https://baz',
            refresh_token='hehe', client_secret='no_secret')

    def test_expires_in(self):
        self.assertLess(self.session.expires_in_sec, 100)

    def test_save_and_load(self):
        keydict = {self.session.SESSION_ARG_KEYNAME: 'mock_key'}
        self.session.save_session(**keydict)

        session = od_api_session.OneDriveAPISession.load_session(**keydict)