Skip to content

Commit

Permalink
Remove old query
Browse files Browse the repository at this point in the history
  • Loading branch information
islean committed Oct 10, 2024
1 parent 68fb8bd commit 1f7e849
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
6 changes: 0 additions & 6 deletions cg/store/filters/status_case_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ def filter_cases_by_priority(cases: Query, priority: str, **kwargs) -> Query:
return cases.filter(Case.priority == priority)


def filter_cases_by_ticket_id(cases: Query, ticket_id: str, **kwargs) -> Query:
"""Filter cases with matching ticket id."""
return cases.filter(Case.tickets.contains(ticket_id))


def filter_cases_for_analysis(cases: Query, **kwargs) -> Query:
"""Filter cases in need of analysis by:
1. Action set to analyze or
Expand Down Expand Up @@ -289,7 +284,6 @@ class CaseFilter(Enum):
BY_WORKFLOWS: Callable = filter_cases_by_workflows
BY_WORKFLOW_SEARCH: Callable = filter_cases_by_workflow_search
BY_PRIORITY: Callable = filter_cases_by_priority
BY_TICKET: Callable = filter_cases_by_ticket_id
FOR_ANALYSIS: Callable = filter_cases_for_analysis
HAS_INACTIVE_ANALYSIS: Callable = filter_inactive_analysis_cases
HAS_SEQUENCE: Callable = filter_cases_has_sequence
Expand Down
31 changes: 0 additions & 31 deletions tests/store/filters/test_status_cases_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
filter_cases_by_entry_id,
filter_cases_by_name,
filter_cases_by_priority,
filter_cases_by_ticket_id,
filter_cases_by_workflow_search,
filter_cases_for_analysis,
filter_cases_has_sequence,
Expand Down Expand Up @@ -704,36 +703,6 @@ def test_filter_running_cases_only_running_cases(store_with_multiple_cases_and_s
assert active_cases.count() == cases_query.count()


def test_filter_cases_by_ticket_no_matching_ticket(
store_with_multiple_cases_and_samples: Store, non_existent_id: str
):
"""Test that no cases are returned when filtering by a non-existent ticket."""
# GIVEN a store containing cases with no matching ticket id
cases_query: Query = store_with_multiple_cases_and_samples._get_query(table=Case)

# WHEN filtering cases by a non-existent ticket
filtered_cases: Query = filter_cases_by_ticket_id(cases=cases_query, ticket_id=non_existent_id)

# THEN the query should return no cases
assert filtered_cases.count() == 0


def test_filter_cases_by_ticket_matching_ticket(
store_with_multiple_cases_and_samples: Store, ticket_id: str
):
"""Test that cases are returned when filtering by an existing ticket id."""
# GIVEN a store containing cases with a matching ticket id
cases_query: Query = store_with_multiple_cases_and_samples._get_query(table=Case)

# WHEN filtering cases by an existing ticket id
filtered_cases: Query = filter_cases_by_ticket_id(cases=cases_query, ticket_id=ticket_id)

# THEN the query should return cases with the matching ticket
assert filtered_cases.count() > 0
for case in filtered_cases:
assert ticket_id in case.tickets


def test_filter_cases_by_customer_entry_ids(store_with_multiple_cases_and_samples: Store):
"""Test that cases are returned when filtering by customer entry ids."""
# GIVEN a store containing cases with customer ids
Expand Down

0 comments on commit 1f7e849

Please sign in to comment.