Skip to content

Commit

Permalink
ci: add dead code detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas1312 committed Oct 10, 2023
1 parent 8b1ae5e commit 023fc21
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ jobs:
- name: Filter dead code
run: |
cat dead_code.log | grep -e "src/kili"
- name: Filter dead code
run: |
cat dead_code.log | grep -e "src/kili" | grep -v -e "src/kili/types.py"
- name: Filter dead code
run: |
Expand All @@ -194,7 +197,7 @@ jobs:
- name: Crash if dead code found
run: |
if [ $(cat dead_code_filtered.log | wc -l) -gt 0 ]; then
cat dead_code.log
cat dead_code_filtered.log
echo "\nDead code found"
exit 1
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
from kili.adapters.kili_api_gateway import KiliAPIGateway
from kili.adapters.kili_api_gateway.cloud_storage import (
DataConnectionComputeDifferencesKiliAPIGatewayInput,
DataIntegrationFilters,
)
from kili.adapters.kili_api_gateway.cloud_storage.operations import (
GQL_COUNT_DATA_INTEGRATIONS,
get_compute_data_connection_differences_mutation,
)
from kili.core.graphql.graphql_client import GraphQLClient
from kili.domain.cloud_storage import DataConnectionId
from kili.domain.cloud_storage import DataConnectionId, DataIntegrationId


def test_given_gateway_when_calling_compute_diff_then_it_works(
Expand Down Expand Up @@ -51,3 +53,27 @@ def test_given_gateway_when_calling_compute_diff_with_data_then_it_works(
"data": {"blobPaths": ["1.jpg", "2.jpg"], "warnings": ["warning1", "warning2"]},
},
)


def test_given_gateway_when_calling_count_data_integrations_then_it_works(
graphql_client: GraphQLClient, http_client: HttpClient
):
# Given
gateway = KiliAPIGateway(graphql_client, http_client)

# When
gateway.count_data_integrations(DataIntegrationFilters(id=DataIntegrationId("fake_id")))

# Then
gateway.graphql_client.execute.assert_called_once_with(
GQL_COUNT_DATA_INTEGRATIONS,
{
"where": {
"status": None,
"id": "fake_id",
"name": None,
"organizationId": None,
"platform": None,
}
},
)

0 comments on commit 023fc21

Please sign in to comment.