Skip to content

Commit

Permalink
test: BI-5886 unknown field in modificators tests (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCPN authored Oct 25, 2024
1 parent f73ac44 commit 4381883
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from http import HTTPStatus
from typing import Optional

import pytest

from dl_api_client.dsmaker.primitives import WhereClause
from dl_api_client.dsmaker.shortcuts.dataset import (
add_formulas_to_dataset,
Expand Down Expand Up @@ -531,3 +533,23 @@ def test_ago_with_different_measures(self, control_api, data_api, saved_dataset)
data_rows = get_data_rows(result_resp)
check_ago_data(data_rows=data_rows, date_idx=0, value_idx=1, ago_idx=3, day_offset=1)
check_ago_data(data_rows=data_rows, date_idx=0, value_idx=2, ago_idx=4, day_offset=1)

@pytest.mark.xfail(reason="https://github.com/datalens-tech/datalens-backend/issues/531") # FIXME
def test_id_with_unknown_field(self, control_api, data_api, saved_dataset):
ds = add_formulas_to_dataset(
api_v1=control_api,
dataset=saved_dataset,
formulas={
"ago id unknown": "AGO(SUM([sales]), [order_date], 'month' IGNORE DIMENSIONS [unknown])",
},
exp_status=HTTPStatus.BAD_REQUEST,
)

result_resp = data_api.get_result(
dataset=ds,
fields=[
ds.find_field(title="ago id unknown"),
],
fail_ok=True,
)
assert result_resp.status_code == HTTPStatus.BAD_REQUEST, result_resp.json
Original file line number Diff line number Diff line change
Expand Up @@ -782,3 +782,23 @@ def get_data(measures: tuple[str, ...]) -> list[list[str]]:
for row_no_sum, row_with_sum in zip(data_rows_no_sum, data_rows_with_sum, strict=True):
assert row_no_sum[0] == row_with_sum[0] # The dimension
assert row_no_sum[1] == row_with_sum[1] # The measure

@pytest.mark.xfail(reason="https://github.com/datalens-tech/datalens-backend/issues/531") # FIXME
def test_bfb_with_unknown_field(self, control_api, data_api, saved_dataset):
ds = add_formulas_to_dataset(
api_v1=control_api,
dataset=saved_dataset,
formulas={
"sales sum bfb unknown": "SUM([sales] BEFORE FILTER BY [unknown])",
},
exp_status=HTTPStatus.BAD_REQUEST,
)

result_resp = data_api.get_result(
dataset=ds,
fields=[
ds.find_field(title="sales sum bfb unknown"),
],
fail_ok=True,
)
assert result_resp.status_code == HTTPStatus.BAD_REQUEST, result_resp.json

0 comments on commit 4381883

Please sign in to comment.