Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run Tests on PR

on:
pull_request:
branches: [ "main" ] # Runs when PR targets 'main'
types: [opened, synchronize] # Runs when PR is opened or updated

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # Check out the repository

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
pip install -r requirements.txt

- name: Run tests
run: |
cd app/
cp ../sample-env .env
python -m unittest
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ variables:

rules:
- if: '$CI_DEPLOY_FREEZE == null'
when: always

.deploy:
stage: deploy
Expand All @@ -51,6 +50,7 @@ variables:
# Build docker image for all branches
build:
extends: .build
needs: ["Test"]

# Prod:WP40:HL:
Prod:
Expand Down
38 changes: 19 additions & 19 deletions app/tests/test_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,45 @@ def setUp(self):
self.client = TestClient(app)
self.api_prefix = ""
self.mock_search_api_url = "/id"
self.stable_id = "ENSG00000139618"
self.stable_id = "ENSAROG00010015245"

self.mock_single_search_results_success = {
"matches": [
{"genome_id": "genome1", "unversioned_stable_id": "ENSG00000139618"}
{"genome_id": "genome1", "unversioned_stable_id": "ENSAROG00010015245"}
]
}
self.mock_single_metadata_results_success = {
"genome1": {
"assembly": {"accession_id": "GCA_000001405.28", "name": "GRCh38"},
"scientific_name": "Homo sapiens",
"common_name": "Human",
"type": "genome",
"unversioned_stable_id": "ENSG00000139618",
"assembly": {"accession_id": "GCA_018555375.2", "name": "ASM1855537v1.1"},
"scientific_name": "Anguilla rostrata",
"common_name": "American eel",
"type": {"kind": "strain", "value": "reference"},
"unversioned_stable_id": "ENSAROG00010015245",
}
}

self.mock_multiple_search_results_success = {
"matches": [
{"genome_id": "genome1", "unversioned_stable_id": "ENSG00000139618"},
{"genome_id": "genome2", "unversioned_stable_id": "ENSG00000139618"},
{"genome_id": "genome1", "unversioned_stable_id": "ENSAROG00010015245"},
{"genome_id": "genome2", "unversioned_stable_id": "ENSAROG00010015245"},
]
}

# Mock metadata API
self.mock_multiple_metadata_results_success = {
"genome1": {
"assembly": {"accession_id": "GCA_000001405.28", "name": "GRCh38"},
"scientific_name": "Homo sapiens",
"common_name": "Human",
"type": "genome",
"unversioned_stable_id": "ENSG00000139618",
"assembly": {"accession_id": "GCA_018555375.2", "name": "ASM1855537v1.1"},
"scientific_name": "Anguilla rostrata",
"common_name": "American eel",
"type": {"kind": "strain", "value": "reference"},
"unversioned_stable_id": "ENSAROG00010015245",
},
"genome2": {
"assembly": {"accession_id": "GCA_000001405.14", "name": "GRCh37"},
"scientific_name": "Homo sapiens",
"common_name": "Human",
"type": "genome",
"unversioned_stable_id": "ENSG00000139618",
"assembly": {"accession_id": "GCA_018555375.3", "name": "ASM1855537v3"},
"scientific_name": "Anguilla rostrata",
"common_name": "American eel",
"type": {"kind": "strain", "value": "reference"},
"unversioned_stable_id": "ENSAROG00010015245",
},
}

Expand Down