forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#[UIC-2021]: replicate api enhancements (#239)
* feat(replicate-api): added support to handle optional req params and refactor code added support to handle optional req params and refactor code UIC-2037 * feat(replicate-api): added slug support in url added slug support in url UIC-2037 * feat(replicate-api): added UT added UT UIC-2037 * feat(replicate-api): updated UT updated UT UIC-2037 * feat(replicate-api): updated user password for UT updated user password for UT UIC-2037 * feat(replicate-api): updated UT updated UT UIC-2037 * feat(replicate-api): updated UT updated UT UIC-2037 * feat(replicate-api): updated UT updated UT UIC-2037 * feat(replicate-api): updated UT updated UT UIC-2037
- Loading branch information
1 parent
bd391d0
commit 3680648
Showing
4 changed files
with
183 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
"""Unit tests for Superset""" | ||
import json | ||
import unittest | ||
|
||
from flask import escape | ||
from sqlalchemy import func | ||
|
||
from superset import db, security_manager | ||
from superset.connectors.sqla.models import SqlaTable | ||
from superset.models import core as models | ||
from .base_tests import SupersetTestCase | ||
|
||
class AddToDashboardTests(SupersetTestCase): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(AddToDashboardTests, self).__init__(*args, **kwargs) | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
pass | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_add_to_dashboard(self): | ||
self.login(username='admin',password='Ym8Hg1+u3VmyM8mRul3xnWuvh2xalT/soSM3z5fTosQ=') | ||
url = '/superset/add_to_dashboard' | ||
self.client.post(url, data=dict( | ||
database_name="test_add_to_dashboard", | ||
sqlalchemy_uri="hive://[email protected]:10000/", | ||
impersonate_user=False, | ||
extra= json.dumps({ | ||
"metadata_params": {}, | ||
"engine_params": {}, | ||
"metadata_cache_timeout": {}, | ||
"schemas_allowed_for_csv_upload": [] | ||
}), | ||
dashboard_title="test_add_to_dashboard", | ||
slug="test_add_to_dashboard", | ||
slices=json.dumps([ | ||
{ | ||
"table_name":"control_plane_table", | ||
"schema":"demo", | ||
"slice_name":"bardemo", | ||
"viz_type":"dist_bar", | ||
"metrics":[{"column":{"column_name":"c_call_duration"}}], | ||
"groupby":["c_to_msisdn"]} | ||
]) | ||
|
||
)) | ||
|
||
dash_added = db.session.query(models.Dashboard).filter_by( | ||
slug='test_add_to_dashboard').first() | ||
slice_added = db.session.query(models.Slice).filter_by( | ||
slice_name='bardemo').first() | ||
assert slice_added in dash_added.slices | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |