Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
eb62162
refactor: TT-185 create SQLBuilder, TimeEntryQueryBuilder and find_al…
kellycastrof Mar 24, 2021
031b883
test: TT-185 query_builder tests
kellycastrof Mar 25, 2021
262ace0
test: TT-185 add test methods for TimeEntryQueryBuilder and new funct…
kellycastrof Mar 26, 2021
7914fdf
build: TT-199 build(deps): bump jinja2 in /requirements/time_tracker…
dependabot[bot] Mar 26, 2021
2b57549
refactor: TT-185 create SQLBuilder, TimeEntryQueryBuilder and find_al…
kellycastrof Mar 24, 2021
7606663
test: TT-185 query_builder tests
kellycastrof Mar 25, 2021
f1fc8a6
test: TT-185 add test methods for TimeEntryQueryBuilder and new funct…
kellycastrof Mar 26, 2021
be72ff8
refactor: TT-185 rename get_string_without_empty_spaces to remove_whi…
kellycastrof Mar 26, 2021
3401b39
refactor: TT-185 add time_entries_id in condition
kellycastrof Mar 26, 2021
2342ce9
refactor: TT-185 delete empty lines
kellycastrof Mar 26, 2021
5358c40
refactor: TT-185 delete isintance validation
kellycastrof Mar 26, 2021
a403edb
refactor: TT-185 improve function remove_white_spaces
Angeluz-07 Mar 26, 2021
d538899
refactor: TT-185 change column to columns
Angeluz-07 Mar 26, 2021
06cbca7
refactor: TT-185 add more scenarios to test_add_sql_in_condition_shou…
Angeluz-07 Mar 26, 2021
a1331fc
refactor: TT-185 add more scenarios to test__build_where_should_retur…
Angeluz-07 Mar 26, 2021
c44f20e
refactor: TT-185 improve test_TimeEntryQueryBuilder_is_subclass_Cosmo…
Angeluz-07 Mar 26, 2021
f17d841
refactor: TT-185 rename args in TimeEntriesRepository
Angeluz-07 Mar 26, 2021
be6e9b1
refactor: TT-185 change the scenarios in test_add_sql_date_range_cond…
kellycastrof Mar 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: TT-185 add more scenarios to test_add_sql_in_condition_shou…
…ld_update_where_list
  • Loading branch information
Angeluz-07 committed Mar 26, 2021
commit 06cbca78b8ae5a42307a79a1a88e12c996167e74
50 changes: 13 additions & 37 deletions tests/utils/query_builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def test_add_select_conditions_should_update_select_list(
(None, ["id"], []),
("id", ["id"], ["c.id IN ('id')"]),
("id", ["id1", "id2"], ["c.id IN ('id1', 'id2')"]),
("owner_id", ["id1", "id2"], ["c.owner_id IN ('id1', 'id2')"]),
("customer_id", ["id1", "id2"], ["c.customer_id IN ('id1', 'id2')"]),
],
)
def test_add_sql_in_condition_should_update_where_list(
attribute,
ids_list,
expected_where_condition_list,
attribute, ids_list, expected_where_condition_list,
):
query_builder = CosmosDBQueryBuilder().add_sql_in_condition(
attribute, ids_list
Expand All @@ -66,9 +66,7 @@ def test_add_sql_in_condition_should_update_where_list(
],
)
def test_add_sql_where_equal_condition_should_update_where_params_list(
data,
expected_where_list,
expected_params,
data, expected_where_list, expected_params,
):
query_builder = CosmosDBQueryBuilder().add_sql_where_equal_condition(data)

Expand All @@ -93,8 +91,7 @@ def test_add_sql_where_equal_condition_with_None_should_not_update_lists():
[(True, ['NOT IS_DEFINED(c.deleted)']), (False, [])],
)
def test_add_sql_visibility_condition(
visibility_bool,
expected_where_list,
visibility_bool, expected_where_list,
):
query_builder = CosmosDBQueryBuilder().add_sql_visibility_condition(
visibility_bool
Expand All @@ -105,12 +102,7 @@ def test_add_sql_visibility_condition(


@pytest.mark.parametrize(
"limit_value,expected_limit",
[
(1, 1),
(10, 10),
(None, None),
],
"limit_value,expected_limit", [(1, 1), (10, 10), (None, None),],
)
def test_add_sql_limit_condition(limit_value, expected_limit):
query_builder = CosmosDBQueryBuilder().add_sql_limit_condition(limit_value)
Expand All @@ -119,16 +111,10 @@ def test_add_sql_limit_condition(limit_value, expected_limit):


@pytest.mark.parametrize(
"offset_value,expected_offset",
[
(1, 1),
(10, 10),
(None, None),
],
"offset_value,expected_offset", [(1, 1), (10, 10), (None, None),],
)
def test_add_sql_offset_condition(
offset_value,
expected_offset,
offset_value, expected_offset,
):
query_builder = CosmosDBQueryBuilder().add_sql_offset_condition(
offset_value
Expand All @@ -139,15 +125,10 @@ def test_add_sql_offset_condition(

@pytest.mark.parametrize(
"select_conditions,expected_condition",
[
([], "*"),
(["c.id"], "c.id"),
(["c.id", "c.name"], "c.id,c.name"),
],
[([], "*"), (["c.id"], "c.id"), (["c.id", "c.name"], "c.id,c.name"),],
)
def test__build_select_return_fields_in_select_list(
select_conditions,
expected_condition,
select_conditions, expected_condition,
):
query_builder = CosmosDBQueryBuilder().add_select_conditions(
select_conditions
Expand All @@ -165,8 +146,7 @@ def test__build_select_return_fields_in_select_list(
],
)
def test__build_where_should_return_concatenate_conditions(
where_dict,
expected_condition,
where_dict, expected_condition,
):
query_builder = CosmosDBQueryBuilder().add_sql_where_equal_condition(
where_dict
Expand All @@ -182,9 +162,7 @@ def test__build_where_should_return_concatenate_conditions(
[(1, "OFFSET @offset", [{'name': '@offset', 'value': 1}]), (None, "", [])],
)
def test__build_offset(
offset,
expected_condition,
expected_params,
offset, expected_condition, expected_params,
):
query_builder = CosmosDBQueryBuilder().add_sql_offset_condition(offset)

Expand All @@ -199,9 +177,7 @@ def test__build_offset(
[(1, "LIMIT @limit", [{'name': '@limit', 'value': 1}]), (None, "", [])],
)
def test__build_limit(
limit,
expected_condition,
expected_params,
limit, expected_condition, expected_params,
):
query_builder = CosmosDBQueryBuilder().add_sql_limit_condition(limit)

Expand Down