Ejemplo n.º 1
0
    def setUp(self):
        super(TestGetTableNamesBySchema, self).setUp()

        self.datastore = self.factory(workspace=self.workspace)
        self.schema = factories.SchemaFactory(datastore=self.datastore)
        self.tables = factories.TableFactory.create_batch(10, schema=self.schema)

        self.other_schema = factories.SchemaFactory(datastore=self.datastore)
        self.other_table = factories.TableFactory(schema=self.other_schema)

        self.variables = {
            'datastoreId': helpers.to_global_id('DatastoreType', self.datastore.pk),
            'schemaName': self.schema.name,
        }
Ejemplo n.º 2
0
    def setUp(self):
        super(TestOmnisearch, self).setUp()

        self.datastore = Datastore.objects.get(id='s4N8p5g0wjiS')
        self.other_datastore = factories.DatastoreFactory(
            workspace=self.workspace)
        self.other_schema = factories.SchemaFactory(
            datastore=self.other_datastore)
        self.other_table = factories.TableFactory(schema=self.other_schema,
                                                  name='customers')
Ejemplo n.º 3
0
    def setUp(self):
        super(TestGetSchemaNamesByDatastore, self).setUp()

        self.datastore = self.factory(workspace=self.workspace)
        self.schemas = factories.SchemaFactory.create_batch(10, datastore=self.datastore)

        self.other_schema = factories.SchemaFactory()

        self.variables = {
            'datastoreId': helpers.to_global_id('DatastoreType', self.datastore.pk),
        }
Ejemplo n.º 4
0
    def setUp(self):
        super(TestGetDatastoreAssets, self).setUp()

        self.datastore = self.factory(workspace=self.workspace)
        self.schema = factories.SchemaFactory(datastore=self.datastore)

        self.assets = []

        for i in range(10):
            self.assets.append(
                factories.TableFactory(name='app%s' % str(i).zfill(3), schema=self.schema)
            )

        for j in range(10):
            self.assets.append(
                factories.TableFactory(name='site%s' % str(j).zfill(3), schema=self.schema)
            )

        self.other_datastore = self.factory(workspace=self.workspace)
        self.other_schema = factories.SchemaFactory(datastore=self.other_datastore)
        self.other_table = factories.TableFactory(schema=self.other_schema, name='yyz')
Ejemplo n.º 5
0
    def _setup_and_get_variables(self, **overrides):
        """Setup test and return variables for query.
        """
        datastore = factories.DatastoreFactory(workspace=self.workspace, **overrides)
        schema = factories.SchemaFactory(workspace=self.workspace, datastore=datastore)

        table = self.factory(workspace=self.workspace, schema=schema)

        variables = {
            'datastoreId': helpers.to_global_id('DatastoreType', datastore.pk),
            'schemaName': schema.name,
            'tableName': table.name,
        }

        return datastore, variables
Ejemplo n.º 6
0
    def test_filter_by_schema(self):
        """It should filter the queryset by the provided schema.
        """
        schema = factories.SchemaFactory(datastore=self.datastore, name='public')
        tables = factories.TableFactory.create_batch(5, schema=schema)

        variables = {
            'datastoreSlug': self.datastore.slug,
            'schemaName': schema.name,
        }

        results = self.execute(self.statement, variables=variables)
        results = results['data'][self.operation]

        self.assertEqual(len(results['edges']), len(tables))