# Path: syncano_cli/config.py
# ACCOUNT_CONFIG = ConfigParser()
# 
# Path: syncano_cli/main.py
# def main():
# 
# Path: syncano_cli/parse_to_syncano/processors/push_notifications.py
# DEVICE_CHANNELS_CLASS_NAME = 'internal_device_channels'
# 
# Path: tests/base.py
# class InstanceMixin(object):
# 
#     @classmethod
#     def setUpClass(cls):
#         super(InstanceMixin, cls).setUpClass()
# 
#         cls.instance = cls.connection.Instance.please.create(
#             name='test-cli-i%s' % cls.generate_hash()[:10],
#             description='IntegrationTest %s' % datetime.now(),
#         )
# 
#     @classmethod
#     def tearDownClass(cls):
#         cls.instance.delete()
#         super(InstanceMixin, cls).tearDownClass()
# 
# class IntegrationTest(unittest.TestCase):
# 
#     @classmethod
#     def setUpClass(cls):
#         cls.runner = CliRunner()
#         cls.API_KEY = os.getenv('INTEGRATION_API_KEY')
#         cls.API_EMAIL = os.getenv('INTEGRATION_API_EMAIL')
#         cls.API_PASSWORD = os.getenv('INTEGRATION_API_PASSWORD')
#         cls.API_ROOT = os.getenv('INTEGRATION_API_ROOT')
# 
#         cls.connection = syncano.connect(
#             host=cls.API_ROOT,
#             email=cls.API_EMAIL,
#             password=cls.API_PASSWORD,
#             api_key=cls.API_KEY
#         )
# 
#     @classmethod
#     def tearDownClass(cls):
#         cls.connection = None
# 
#     @classmethod
#     def generate_hash(cls):
#         hash_feed = '{}{}'.format(uuid4(), datetime.now())
#         return md5(hash_feed.encode('ascii')).hexdigest()


import json
import mock
from syncano_cli.config import ACCOUNT_CONFIG
from syncano_cli.main import cli
from syncano_cli.parse_to_syncano.processors.push_notifications import DEVICE_CHANNELS_CLASS_NAME
from tests.base import InstanceMixin, IntegrationTest
# -*- coding: utf-8 -*-



class MigrateCommandsTest(InstanceMixin, IntegrationTest):

    @classmethod
    def setUpClass(cls):
        super(MigrateCommandsTest, cls).setUpClass()
        # do a login first;
        cls.runner.invoke(cli, args=['login', '--instance-name', cls.instance.name], obj={})
        # and make setup;
        cls.old_key = cls.connection.connection().api_key
        cls._set_up_configuration()

    @classmethod
    def _set_up_configuration(cls):

# Path: syncano_cli/config.py
# ACCOUNT_CONFIG = ConfigParser()
# 
# Path: syncano_cli/main.py
# def main():
# 
# Path: syncano_cli/parse_to_syncano/processors/push_notifications.py
# DEVICE_CHANNELS_CLASS_NAME = 'internal_device_channels'
# 
# Path: tests/base.py
# class InstanceMixin(object):
# 
#     @classmethod
#     def setUpClass(cls):
#         super(InstanceMixin, cls).setUpClass()
# 
#         cls.instance = cls.connection.Instance.please.create(
#             name='test-cli-i%s' % cls.generate_hash()[:10],
#             description='IntegrationTest %s' % datetime.now(),
#         )
# 
#     @classmethod
#     def tearDownClass(cls):
#         cls.instance.delete()
#         super(InstanceMixin, cls).tearDownClass()
# 
# class IntegrationTest(unittest.TestCase):
# 
#     @classmethod
#     def setUpClass(cls):
#         cls.runner = CliRunner()
#         cls.API_KEY = os.getenv('INTEGRATION_API_KEY')
#         cls.API_EMAIL = os.getenv('INTEGRATION_API_EMAIL')
#         cls.API_PASSWORD = os.getenv('INTEGRATION_API_PASSWORD')
#         cls.API_ROOT = os.getenv('INTEGRATION_API_ROOT')
# 
#         cls.connection = syncano.connect(
#             host=cls.API_ROOT,
#             email=cls.API_EMAIL,
#             password=cls.API_PASSWORD,
#             api_key=cls.API_KEY
#         )
# 
#     @classmethod
#     def tearDownClass(cls):
#         cls.connection = None
# 
#     @classmethod
#     def generate_hash(cls):
#         hash_feed = '{}{}'.format(uuid4(), datetime.now())
#         return md5(hash_feed.encode('ascii')).hexdigest()


# Path: tests/test_migrate_commands.py
import json
import mock
from syncano_cli.config import ACCOUNT_CONFIG
from syncano_cli.main import cli
from syncano_cli.parse_to_syncano.processors.push_notifications import DEVICE_CHANNELS_CLASS_NAME
from tests.base import InstanceMixin, IntegrationTest

# -*- coding: utf-8 -*-



class MigrateCommandsTest(InstanceMixin, IntegrationTest):

    @classmethod
    def setUpClass(cls):
        super(MigrateCommandsTest, cls).setUpClass()
        # do a login first;
        cls.runner.invoke(cli, args=['login', '--instance-name', cls.instance.name], obj={})
        # and make setup;
        cls.old_key = cls.connection.connection().api_key
        cls._set_up_configuration()

    @classmethod
    def _set_up_configuration(cls):

        SYNCANO_ADMIN_API_KEY = ACCOUNT_CONFIG.get("DEFAULT", "key")