# Path: intuition/test_utils.py
# class FakeContext(ContextFactory):
#     ''' Returns fake configuration '''
# 
#     def initialize(self, storage):
#         self.storage = storage
#         self.raise_error = not bool(storage['params'].get('valid', True))
#         self.bad_format = bool(storage['params'].get('format', False))
# 
#     def load(self):
#         if self.raise_error:
#             raise ValueError
#         return {
#             'universe': 'forex,5',
#             'index': pd.date_range('2012/01/01', '2012/02/01'),
#             'modules': {
#                 'algorithm': 'fake_algorithm',
#                 'manager': 'fake_manager',
#                 'backtest': 'fake_backtest',
#                 'live': 'fake_live'
#             }
#         } if not self.bad_format else {}


import unittest
import dna.test_utils
import pandas as pd
import intuition.api.context as context
from nose.tools import ok_, eq_
from intuition.test_utils import FakeContext
        self.assertListEqual(sorted(['uri', 'path', 'params']),
                             sorted(properties.keys()))
        eq_(properties['uri'], 'localhost:1234')
        self.assertListEqual(properties['path'], ['some', 'where'])
        self.assertDictEqual(properties['params'], {'fake': 'true'})

    def test_parse_bad_format_storage(self):
        properties = context.parse_storage(self.bad_storage)
        self.assertListEqual(sorted(['uri', 'path', 'params']),
                             sorted(properties.keys()))


class ContextFactoryTestCase(unittest.TestCase):

    def setUp(self):
        dna.test_utils.setup_logger(self)
        self.good_storage = 'localhost:1234/some/where?fake=true'
        self.bad_storage = 'evezbb54bz2r'

    def tearDown(self):
        dna.test_utils.teardown_logger(self)

    def test_initialize_fake_context(self):
        fake = FakeContext(self.good_storage)
        ok_(hasattr(fake, 'log'))
        self.assertListEqual(sorted(['uri', 'path', 'params']),
                             sorted(fake.storage.keys()))

    def test__normalize_empty_data_types(self):
        empty_data = {}

# Path: intuition/test_utils.py
# class FakeContext(ContextFactory):
#     ''' Returns fake configuration '''
# 
#     def initialize(self, storage):
#         self.storage = storage
#         self.raise_error = not bool(storage['params'].get('valid', True))
#         self.bad_format = bool(storage['params'].get('format', False))
# 
#     def load(self):
#         if self.raise_error:
#             raise ValueError
#         return {
#             'universe': 'forex,5',
#             'index': pd.date_range('2012/01/01', '2012/02/01'),
#             'modules': {
#                 'algorithm': 'fake_algorithm',
#                 'manager': 'fake_manager',
#                 'backtest': 'fake_backtest',
#                 'live': 'fake_live'
#             }
#         } if not self.bad_format else {}


# Path: tests/api/test_context.py
import unittest
import dna.test_utils
import pandas as pd
import intuition.api.context as context
from nose.tools import ok_, eq_
from intuition.test_utils import FakeContext

        self.assertListEqual(sorted(['uri', 'path', 'params']),
                             sorted(properties.keys()))
        eq_(properties['uri'], 'localhost:1234')
        self.assertListEqual(properties['path'], ['some', 'where'])
        self.assertDictEqual(properties['params'], {'fake': 'true'})

    def test_parse_bad_format_storage(self):
        properties = context.parse_storage(self.bad_storage)
        self.assertListEqual(sorted(['uri', 'path', 'params']),
                             sorted(properties.keys()))


class ContextFactoryTestCase(unittest.TestCase):

    def setUp(self):
        dna.test_utils.setup_logger(self)
        self.good_storage = 'localhost:1234/some/where?fake=true'
        self.bad_storage = 'evezbb54bz2r'

    def tearDown(self):
        dna.test_utils.teardown_logger(self)

    def test_initialize_fake_context(self):
        fake = FakeContext(self.good_storage)
        ok_(hasattr(fake, 'log'))
        self.assertListEqual(sorted(['uri', 'path', 'params']),
                             sorted(fake.storage.keys()))

    def test__normalize_empty_data_types(self):
        empty_data = {}

        fake = FakeContext(self.good_storage)