Skip to content

Commit

Permalink
Commit from GitHub Actions (auto-format)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 14, 2022
1 parent 3c1b41e commit beda7a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
5 changes: 2 additions & 3 deletions api/cueSearch/tests/test_services_globalDimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def testGlobalDimension(client, mocker):
response = client.post(path, payload, content_type="application/json")
mockResponse.stop()
assert response.data["success"] == False
assert response.json()['message'] == 'Id is mandatory'
assert response.json()["message"] == "Id is mandatory"

# checking the publishing api exception with id error
mockResponse.start()
Expand All @@ -130,8 +130,7 @@ def testGlobalDimension(client, mocker):
response = client.post(path, payload, content_type="application/json")
mockResponse.stop()
assert response.data["success"] == False
assert response.json()['message'] == 'Error occured while updating global dimension'

assert response.json()["message"] == "Error occured while updating global dimension"

# Deleting the global dimension called Brands
mockResponse.start()
Expand Down
35 changes: 22 additions & 13 deletions api/dataset/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,43 @@ def test_query(client, mocker):
"""
Test case for connections
"""
connectionType = mixer.blend('dataset.connectionType', label='druid', name='Druid')
connection = mixer.blend('dataset.connection', name='druid_test_data', description='Test', connectionType=connectionType)
connectionParam = mixer.blend('dataset.connectionParam', name="test_druid_param", label='test_druid_param', connectionType=connectionType)

connectionType = mixer.blend("dataset.connectionType", label="druid", name="Druid")
connection = mixer.blend(
"dataset.connection",
name="druid_test_data",
description="Test",
connectionType=connectionType,
)
connectionParam = mixer.blend(
"dataset.connectionParam",
name="test_druid_param",
label="test_druid_param",
connectionType=connectionType,
)

payload = {
"sql": "SELECT DATE_TRUNC('DAY', __time) as ReturnDate,\nDeliveryRegionCode as DeliveryRegion, P_BRANDCODE as Brand, WarehouseCode,\nSUM(\"count\") as ReturnEntries, sum(P_FINALREFUNDAMOUNT) as RefundAmount\nFROM RETURNENTRY\nWHERE __time >= CURRENT_TIMESTAMP - INTERVAL '13' MONTH \nGROUP BY 1, 2, 3, 4\nORDER BY 1",
"connectionId": connection.id
"sql": "SELECT DATE_TRUNC('DAY', __time) as ReturnDate,\nDeliveryRegionCode as DeliveryRegion, P_BRANDCODE as Brand, WarehouseCode,\nSUM(\"count\") as ReturnEntries, sum(P_FINALREFUNDAMOUNT) as RefundAmount\nFROM RETURNENTRY\nWHERE __time >= CURRENT_TIMESTAMP - INTERVAL '13' MONTH \nGROUP BY 1, 2, 3, 4\nORDER BY 1",
"connectionId": connection.id,
}
df = pd.DataFrame()
mockResponse = mocker.patch(
"access.data.Data.runQueryOnConnection",
new=mock.MagicMock(autospec=True, return_value=df),
)
path = reverse('querys')
response = client.post(path,payload, content_type="application/json")
path = reverse("querys")
response = client.post(path, payload, content_type="application/json")
mockResponse.stop()
assert response.status_code == 200
assert response.json()['success'] == True
assert response.json()["success"] == True

df = []
mockResponse = mocker.patch(
"access.data.Data.runQueryOnConnection",
new=mock.MagicMock(autospec=True, return_value=df),
)
path = reverse('querys')
response = client.post(path,payload, content_type="application/json")
path = reverse("querys")
response = client.post(path, payload, content_type="application/json")
mockResponse.stop()

assert response.status_code == 200
assert response.json()['success'] == False
assert response.json()["success"] == False

0 comments on commit beda7a0

Please sign in to comment.