Exemplo n.º 1
0
 def python_value(self, value):
     return ConfigurationContainer.from_json(value)
Exemplo n.º 2
0
                            name='John Doe',
                            email=Sequence('test{}@example.com'),
                            group_ids=[2],
                            org_id=1)

org_factory = ModelFactory(redash.models.Organization,
                           name=Sequence("Org {}"),
                           slug=Sequence("org{}.example.com"),
                           settings={})

data_source_factory = ModelFactory(
    redash.models.DataSource,
    name=Sequence('Test {}'),
    type='pg',
    # If we don't use lambda here it will reuse the same options between tests:
    options=lambda: ConfigurationContainer.from_json('{"dbname": "test"}'),
    org_id=1)

dashboard_factory = ModelFactory(redash.models.Dashboard,
                                 name='test',
                                 user=user_factory.create,
                                 layout='[]',
                                 is_draft=False,
                                 org=1)

api_key_factory = ModelFactory(redash.models.ApiKey,
                               object=dashboard_factory.create)

query_factory = ModelFactory(redash.models.Query,
                             name='Query',
                             description='',
Exemplo n.º 3
0
user_factory = ModelFactory(redash.models.User,
                            name='John Doe', email=Sequence('test{}@example.com'),
                            groups=[2],
                            org=1)

org_factory = ModelFactory(redash.models.Organization,
                           name=Sequence("Org {}"),
                           slug=Sequence("org{}.example.com"),
                           settings={})

data_source_factory = ModelFactory(redash.models.DataSource,
                                   name=Sequence('Test {}'),
                                   type='pg',
                                   # If we don't use lambda here it will reuse the same options between tests:
                                   options=lambda: ConfigurationContainer.from_json('{"dbname": "test"}'),
                                   org=1)

dashboard_factory = ModelFactory(redash.models.Dashboard,
                                 name='test', user=user_factory.create, layout='[]', org=1)

api_key_factory = ModelFactory(redash.models.ApiKey,
                               object=dashboard_factory.create)

query_factory = ModelFactory(redash.models.Query,
                             name='New Query',
                             description='',
                             query='SELECT 1',
                             user=user_factory.create,
                             is_archived=False,
                             schedule=None,
Exemplo n.º 4
0
 def process_result_value(self, value, dialect):
     return ConfigurationContainer.from_json(
         super(EncryptedConfiguration,
               self).process_result_value(value, dialect))
Exemplo n.º 5
0
 def python_value(self, value):
     return ConfigurationContainer.from_json(value)
Exemplo n.º 6
0
 def test_adds_data_source_to_default_group(self):
     data_source = DataSource.create_with_group(org=self.factory.org, name='test', options=ConfigurationContainer.from_json('{"dbname": "test"}'), type='pg')
     self.assertIn(self.factory.org.default_group.id, data_source.groups)
Exemplo n.º 7
0
 def process_result_value(self, value, dialect):
     return ConfigurationContainer.from_json(value)
Exemplo n.º 8
0

user_factory = ModelFactory(redash.models.User,
                            name='John Doe', email=Sequence('test{}@example.com'),
                            groups=[2],
                            org=1)

org_factory = ModelFactory(redash.models.Organization,
                           name=Sequence("Org {}"),
                           slug=Sequence("org{}.example.com"),
                           settings={})

data_source_factory = ModelFactory(redash.models.DataSource,
                                   name=Sequence('Test {}'),
                                   type='pg',
                                   options=ConfigurationContainer.from_json('{"dbname": "test"}'),
                                   org=1)

dashboard_factory = ModelFactory(redash.models.Dashboard,
                                 name='test', user=user_factory.create, layout='[]', org=1)

query_factory = ModelFactory(redash.models.Query,
                             name='New Query',
                             description='',
                             query='SELECT 1',
                             user=user_factory.create,
                             is_archived=False,
                             schedule=None,
                             data_source=data_source_factory.create,
                             org=1)
Exemplo n.º 9
0
 def test_adds_data_source_to_default_group(self):
     data_source = DataSource.create_with_group(org=self.factory.org, name='test', options=ConfigurationContainer.from_json('{"dbname": "test"}'), type='pg')
     self.assertIn(self.factory.org.default_group.id, data_source.groups)
Exemplo n.º 10
0
 def process_result_value(self, value, dialect):
     return ConfigurationContainer.from_json(super(EncryptedConfiguration, self).process_result_value(value, dialect))
Exemplo n.º 11
0
 def process_result_value(self, value, dialect):
     return ConfigurationContainer.from_json(value)
Exemplo n.º 12
0
user_factory = ModelFactory(redash.models.User,
                            name='John Doe',
                            email=Sequence('test{}@example.com'),
                            groups=[2],
                            org=1)

org_factory = ModelFactory(redash.models.Organization,
                           name=Sequence("Org {}"),
                           slug=Sequence("org{}.example.com"),
                           settings={})

data_source_factory = ModelFactory(
    redash.models.DataSource,
    name=Sequence('Test {}'),
    type='pg',
    options=ConfigurationContainer.from_json('{"dbname": "test"}'),
    org=1)

dashboard_factory = ModelFactory(redash.models.Dashboard,
                                 name='test',
                                 user=user_factory.create,
                                 layout='[]',
                                 org=1)

api_key_factory = ModelFactory(redash.models.ApiKey,
                               object=dashboard_factory.create)

query_factory = ModelFactory(redash.models.Query,
                             name='New Query',
                             description='',
                             query='SELECT 1',