예제 #1
0
    def setUpClass(cls):
        httpretty.enable()
        dataset_data = {'dataset_data': DatasetDataFactory.build()}
        httpretty.register_uri(
            httpretty.GET,
            re.compile('https://www.quandl.com/api/v3/datasets*'),
            body=json.dumps(dataset_data))
        cls.expected_raw_data = [{
            'date': datetime.date(2015, 7, 11),
            'column1': 444.3,
            'column2': 10,
            'column3': 3
        }, {
            'date': datetime.date(2015, 7, 13),
            'column1': 433.3,
            'column2': 4,
            'column3': 3
        }, {
            'date': datetime.date(2015, 7, 14),
            'column1': 437.5,
            'column2': 3,
            'column3': 3
        }, {
            'date': datetime.date(2015, 7, 15),
            'column1': 440.0,
            'column2': 2,
            'column3': 3
        }]

        cls.expected_list_values = [[datetime.date(2015, 7, 11), 444.3, 10, 3],
                                    [datetime.date(2015, 7, 13), 433.3, 4, 3],
                                    [datetime.date(2015, 7, 14), 437.5, 3, 3],
                                    [datetime.date(2015, 7, 15), 440.0, 2, 3]]
예제 #2
0
 def setUpClass(cls):
     httpretty.enable()
     datasets = {'datasets': DatasetFactory.build_batch(3)}
     meta = {'meta': MetaFactory.build(current_page=1, total_pages=1)}
     datasets.update(meta)
     httpretty.register_uri(httpretty.GET,
                            re.compile(
                                'https://www.quandl.com/api/v3/datasets*'),
                            body=json.dumps(datasets))
예제 #3
0
 def setUpClass(cls):
     httpretty.enable()
     database = {'database': DatabaseFactory.build(database_code='NSE')}
     httpretty.register_uri(httpretty.GET,
                            re.compile(
                                'https://www.quandl.com/api/v3/databases/*'),
                            body=json.dumps(database))
     cls.db_instance = Database(Database.get_code_from_meta(
         database['database']), database['database'])
 def setUpClass(cls):
     httpretty.enable()
     datasets = {'datasets': DatasetFactory.build_batch(3)}
     meta = {'meta': MetaFactory.build(current_page=1, total_pages=1)}
     datasets.update(meta)
     httpretty.register_uri(httpretty.GET,
                            re.compile(
                                'https://www.quandl.com/api/v3/datasets*'),
                            body=json.dumps(datasets))
예제 #5
0
 def setUpClass(cls):
     httpretty.enable()
     dataset = {'dataset': DatasetFactory.build(
         database_code='NSE', dataset_code='OIL')}
     httpretty.register_uri(httpretty.GET,
                            re.compile(
                                'https://www.quandl.com/api/v3/datasets/*'),
                            body=json.dumps(dataset))
     dataset_code = Dataset.get_code_from_meta(dataset['dataset'])
     cls.dataset_instance = Dataset(dataset_code, dataset['dataset'])
예제 #6
0
 def setUpClass(cls):
     httpretty.enable()
     databases = {'databases': DatabaseFactory.build_batch(10)}
     meta = {'meta': MetaFactory.build()}
     databases.update(meta)
     httpretty.register_uri(httpretty.GET,
                            re.compile(
                                'https://www.quandl.com/api/v3/databases*'),
                            body=json.dumps(databases))
     cls.expected_databases = databases
 def setUpClass(cls):
     httpretty.enable()
     dataset = {'dataset': DatasetFactory.build(
         database_code='NSE', dataset_code='OIL')}
     httpretty.register_uri(httpretty.GET,
                            re.compile(
                                'https://www.quandl.com/api/v3/datasets/*'),
                            body=json.dumps(dataset))
     dataset_code = Dataset.get_code_from_meta(dataset['dataset'])
     cls.dataset_instance = Dataset(dataset_code, dataset['dataset'])
예제 #8
0
 def setUpClass(cls):
     httpretty.enable()
     httpretty.register_uri(httpretty.GET,
                            re.compile(
                                'https://www.quandl.com/api/v3/databases/*'),
                            adding_headers={
                                'Location': 'https://www.blah.com/download/db.zip'
                            },
                            body='{}', status=302)
     httpretty.register_uri(httpretty.GET,
                            re.compile('https://www.blah.com/'), body='{}')
예제 #9
0
    def setUp(self):
        httpretty.enable()
        httpretty.register_uri(httpretty.GET,
                               re.compile(
                                   'https://www.quandl.com/api/v3/databases/*'),
                               adding_headers={
                                   'Location': 'https://www.blah.com/download/db.zip'
                               },
                               body='{}', status=302)
        httpretty.register_uri(httpretty.GET,
                               re.compile('https://www.blah.com/'), body='{}')

        database = {'database': DatabaseFactory.build(database_code='NSE')}
        self.database = Database(database['database']['database_code'], database['database'])
        ApiConfig.api_key = 'api_token'
        ApiConfig.api_version = '2015-04-09'
    def setUp(self):
        httpretty.enable()
        httpretty.register_uri(
            httpretty.GET,
            re.compile('https://www.quandl.com/api/v3/databases/*'),
            adding_headers={
                'Location': 'https://www.blah.com/download/db.zip'
            },
            body='{}',
            status=302)
        httpretty.register_uri(httpretty.GET,
                               re.compile('https://www.blah.com/'),
                               body='{}')

        database = {'database': DatabaseFactory.build(database_code='NSE')}
        self.database = Database(database['database']['database_code'],
                                 database['database'])
        ApiConfig.api_key = 'api_token'
        ApiConfig.api_version = '2015-04-09'
예제 #11
0
    def setUpClass(cls):
        httpretty.enable()
        dataset_data = {'dataset_data': DatasetDataFactory.build()}
        httpretty.register_uri(httpretty.GET,
                               re.compile(
                                   'https://www.quandl.com/api/v3/datasets*'),
                               body=json.dumps(dataset_data))
        cls.expected_raw_data = [{'date': datetime.date(2015, 7, 11), 'column1': 444.3,
                                  'column2': 10, 'column3': 3},
                                 {'date': datetime.date(2015, 7, 13), 'column1': 433.3,
                                  'column2': 4, 'column3': 3},
                                 {'date': datetime.date(2015, 7, 14), 'column1': 437.5,
                                  'column2': 3, 'column3': 3},
                                 {'date': datetime.date(2015, 7, 15), 'column1': 440.0,
                                  'column2': 2, 'column3': 3}]

        cls.expected_list_values = [[datetime.date(2015, 7, 11), 444.3, 10, 3],
                                    [datetime.date(2015, 7, 13), 433.3, 4, 3],
                                    [datetime.date(2015, 7, 14), 437.5, 3, 3],
                                    [datetime.date(2015, 7, 15), 440.0, 2, 3]]
 def setUp(self):
     httpretty.enable()