Skip to content

Commit 2e1decf

Browse files
committed
update tests
1 parent e4dae22 commit 2e1decf

File tree

3 files changed

+185
-7
lines changed

3 files changed

+185
-7
lines changed

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from ga4gh.vrs import models
77
from pydantic import BaseModel
88

9+
from anyvlm.anyvar.http_client import HttpAnyVarClient
10+
911

1012
@pytest.fixture(scope="session", autouse=True)
1113
def load_env():
@@ -58,3 +60,12 @@ def vcr_config():
5860
"before_record_response": remove_response_headers,
5961
"decode_compressed_response": True,
6062
}
63+
64+
65+
@pytest.fixture
66+
def anyvar_client() -> HttpAnyVarClient:
67+
"""Provide AnyVar client fixture for tests.
68+
69+
Uses HTTP because that's auto-mockable with pytest-record
70+
"""
71+
return HttpAnyVarClient()
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers: {}
5+
method: GET
6+
uri: http://localhost:5000/seqrepo/1/metadata/GRCh38:chr1
7+
response:
8+
body:
9+
string: "{\n \"added\": \"2016-08-27T21:17:00Z\",\n \"aliases\": [\n \"GRCh38:1\",\n
10+
\ \"GRCh38:chr1\",\n \"GRCh38.p1:1\",\n \"GRCh38.p1:chr1\",\n \"GRCh38.p10:1\",\n
11+
\ \"GRCh38.p10:chr1\",\n \"GRCh38.p11:1\",\n \"GRCh38.p11:chr1\",\n
12+
\ \"GRCh38.p12:1\",\n \"GRCh38.p12:chr1\",\n \"GRCh38.p2:1\",\n \"GRCh38.p2:chr1\",\n
13+
\ \"GRCh38.p3:1\",\n \"GRCh38.p3:chr1\",\n \"GRCh38.p4:1\",\n \"GRCh38.p4:chr1\",\n
14+
\ \"GRCh38.p5:1\",\n \"GRCh38.p5:chr1\",\n \"GRCh38.p6:1\",\n \"GRCh38.p6:chr1\",\n
15+
\ \"GRCh38.p7:1\",\n \"GRCh38.p7:chr1\",\n \"GRCh38.p8:1\",\n \"GRCh38.p8:chr1\",\n
16+
\ \"GRCh38.p9:1\",\n \"GRCh38.p9:chr1\",\n \"MD5:6aef897c3d6ff0c78aff06ac189178dd\",\n
17+
\ \"NCBI:NC_000001.11\",\n \"refseq:NC_000001.11\",\n \"SEGUID:FCUd6VJ6uikS/VWLbhGdVmj2rOA\",\n
18+
\ \"SHA1:14251de9527aba2912fd558b6e119d5668f6ace0\",\n \"VMC:GS_Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n
19+
\ \"sha512t24u:Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n \"ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\"\n
20+
\ ],\n \"alphabet\": \"ACGMNRT\",\n \"length\": 248956422\n}\n"
21+
headers: {}
22+
status:
23+
code: 200
24+
message: OK
25+
- request:
26+
body: null
27+
headers: {}
28+
method: GET
29+
uri: http://localhost:5000/seqrepo/1/sequence/GRCh38:chr1?start=160208880&end=160208881
30+
response:
31+
body:
32+
string: A
33+
headers: {}
34+
status:
35+
code: 200
36+
message: OK
37+
- request:
38+
body: null
39+
headers: {}
40+
method: GET
41+
uri: http://localhost:5000/seqrepo/1/metadata/ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO
42+
response:
43+
body:
44+
string: "{\n \"added\": \"2016-08-27T21:17:00Z\",\n \"aliases\": [\n \"GRCh38:1\",\n
45+
\ \"GRCh38:chr1\",\n \"GRCh38.p1:1\",\n \"GRCh38.p1:chr1\",\n \"GRCh38.p10:1\",\n
46+
\ \"GRCh38.p10:chr1\",\n \"GRCh38.p11:1\",\n \"GRCh38.p11:chr1\",\n
47+
\ \"GRCh38.p12:1\",\n \"GRCh38.p12:chr1\",\n \"GRCh38.p2:1\",\n \"GRCh38.p2:chr1\",\n
48+
\ \"GRCh38.p3:1\",\n \"GRCh38.p3:chr1\",\n \"GRCh38.p4:1\",\n \"GRCh38.p4:chr1\",\n
49+
\ \"GRCh38.p5:1\",\n \"GRCh38.p5:chr1\",\n \"GRCh38.p6:1\",\n \"GRCh38.p6:chr1\",\n
50+
\ \"GRCh38.p7:1\",\n \"GRCh38.p7:chr1\",\n \"GRCh38.p8:1\",\n \"GRCh38.p8:chr1\",\n
51+
\ \"GRCh38.p9:1\",\n \"GRCh38.p9:chr1\",\n \"MD5:6aef897c3d6ff0c78aff06ac189178dd\",\n
52+
\ \"NCBI:NC_000001.11\",\n \"refseq:NC_000001.11\",\n \"SEGUID:FCUd6VJ6uikS/VWLbhGdVmj2rOA\",\n
53+
\ \"SHA1:14251de9527aba2912fd558b6e119d5668f6ace0\",\n \"VMC:GS_Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n
54+
\ \"sha512t24u:Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n \"ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\"\n
55+
\ ],\n \"alphabet\": \"ACGMNRT\",\n \"length\": 248956422\n}\n"
56+
headers: {}
57+
status:
58+
code: 200
59+
message: OK
60+
- request:
61+
body: null
62+
headers: {}
63+
method: GET
64+
uri: http://localhost:5000/seqrepo/1/sequence/ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO?start=160208880&end=160208881
65+
response:
66+
body:
67+
string: A
68+
headers: {}
69+
status:
70+
code: 200
71+
message: OK
72+
- request:
73+
body: null
74+
headers: {}
75+
method: GET
76+
uri: http://localhost:5000/seqrepo/1/sequence/GRCh38:chr1?start=160208934&end=160208935
77+
response:
78+
body:
79+
string: A
80+
headers: {}
81+
status:
82+
code: 200
83+
message: OK
84+
- request:
85+
body: null
86+
headers: {}
87+
method: GET
88+
uri: http://localhost:5000/seqrepo/1/sequence/ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO?start=160208934&end=160208935
89+
response:
90+
body:
91+
string: A
92+
headers: {}
93+
status:
94+
code: 200
95+
message: OK
96+
- request:
97+
body: null
98+
headers: {}
99+
method: GET
100+
uri: http://localhost:5000/seqrepo/1/sequence/GRCh38:chr1?start=160208970&end=160208971
101+
response:
102+
body:
103+
string: C
104+
headers: {}
105+
status:
106+
code: 200
107+
message: OK
108+
- request:
109+
body: null
110+
headers: {}
111+
method: GET
112+
uri: http://localhost:5000/seqrepo/1/sequence/ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO?start=160208970&end=160208971
113+
response:
114+
body:
115+
string: C
116+
headers: {}
117+
status:
118+
code: 200
119+
message: OK
120+
- request:
121+
body: '{"id": "ga4gh:VA.J3Hi64dkKFKdnKIwB2419Qz3STDB2sJq", "type": "Allele", "digest":
122+
"J3Hi64dkKFKdnKIwB2419Qz3STDB2sJq", "location": {"id": "ga4gh:SL._iSMSsX8LVlBhygQTF-qI8PIiPMvKyX1",
123+
"type": "SequenceLocation", "digest": "_iSMSsX8LVlBhygQTF-qI8PIiPMvKyX1", "sequenceReference":
124+
{"type": "SequenceReference", "refgetAccession": "SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"},
125+
"start": 160208880, "end": 160208881}, "state": {"type": "LiteralSequenceExpression",
126+
"sequence": "C"}}'
127+
headers: {}
128+
method: PUT
129+
uri: http://localhost:8000/vrs_variation
130+
response:
131+
body:
132+
string: '{"messages":[],"object":{"id":"ga4gh:VA.J3Hi64dkKFKdnKIwB2419Qz3STDB2sJq","type":"Allele","digest":"J3Hi64dkKFKdnKIwB2419Qz3STDB2sJq","location":{"id":"ga4gh:SL._iSMSsX8LVlBhygQTF-qI8PIiPMvKyX1","type":"SequenceLocation","digest":"_iSMSsX8LVlBhygQTF-qI8PIiPMvKyX1","sequenceReference":{"type":"SequenceReference","refgetAccession":"SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"},"start":160208880,"end":160208881},"state":{"type":"LiteralSequenceExpression","sequence":"C"}},"object_id":"ga4gh:VA.J3Hi64dkKFKdnKIwB2419Qz3STDB2sJq"}'
133+
headers: {}
134+
status:
135+
code: 200
136+
message: OK
137+
- request:
138+
body: '{"id": "ga4gh:VA.cBM4F57wcT0WN7lZ5iJ8RrYooERbb_qr", "type": "Allele", "digest":
139+
"cBM4F57wcT0WN7lZ5iJ8RrYooERbb_qr", "location": {"id": "ga4gh:SL.ukxL6Ds27MlHSPN9c7FuKtue7fix0mg2",
140+
"type": "SequenceLocation", "digest": "ukxL6Ds27MlHSPN9c7FuKtue7fix0mg2", "sequenceReference":
141+
{"type": "SequenceReference", "refgetAccession": "SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"},
142+
"start": 160208934, "end": 160208935}, "state": {"type": "LiteralSequenceExpression",
143+
"sequence": "C"}}'
144+
headers: {}
145+
method: PUT
146+
uri: http://localhost:8000/vrs_variation
147+
response:
148+
body:
149+
string: '{"messages":[],"object":{"id":"ga4gh:VA.cBM4F57wcT0WN7lZ5iJ8RrYooERbb_qr","type":"Allele","digest":"cBM4F57wcT0WN7lZ5iJ8RrYooERbb_qr","location":{"id":"ga4gh:SL.ukxL6Ds27MlHSPN9c7FuKtue7fix0mg2","type":"SequenceLocation","digest":"ukxL6Ds27MlHSPN9c7FuKtue7fix0mg2","sequenceReference":{"type":"SequenceReference","refgetAccession":"SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"},"start":160208934,"end":160208935},"state":{"type":"LiteralSequenceExpression","sequence":"C"}},"object_id":"ga4gh:VA.cBM4F57wcT0WN7lZ5iJ8RrYooERbb_qr"}'
150+
headers: {}
151+
status:
152+
code: 200
153+
message: OK
154+
- request:
155+
body: '{"id": "ga4gh:VA.Tx1gJiL1oQdOBdD07KK95VxR8NbUcg21", "type": "Allele", "digest":
156+
"Tx1gJiL1oQdOBdD07KK95VxR8NbUcg21", "location": {"id": "ga4gh:SL.y2nvzxXsN3yEY_xhT6bjYOYH6SzHuQQ9",
157+
"type": "SequenceLocation", "digest": "y2nvzxXsN3yEY_xhT6bjYOYH6SzHuQQ9", "sequenceReference":
158+
{"type": "SequenceReference", "refgetAccession": "SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"},
159+
"start": 160208970, "end": 160208971}, "state": {"type": "LiteralSequenceExpression",
160+
"sequence": "T"}}'
161+
headers: {}
162+
method: PUT
163+
uri: http://localhost:8000/vrs_variation
164+
response:
165+
body:
166+
string: '{"messages":[],"object":{"id":"ga4gh:VA.Tx1gJiL1oQdOBdD07KK95VxR8NbUcg21","type":"Allele","digest":"Tx1gJiL1oQdOBdD07KK95VxR8NbUcg21","location":{"id":"ga4gh:SL.y2nvzxXsN3yEY_xhT6bjYOYH6SzHuQQ9","type":"SequenceLocation","digest":"y2nvzxXsN3yEY_xhT6bjYOYH6SzHuQQ9","sequenceReference":{"type":"SequenceReference","refgetAccession":"SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO"},"start":160208970,"end":160208971},"state":{"type":"LiteralSequenceExpression","sequence":"T"}},"object_id":"ga4gh:VA.Tx1gJiL1oQdOBdD07KK95VxR8NbUcg21"}'
167+
headers: {}
168+
status:
169+
code: 200
170+
message: OK
171+
version: 1

tests/unit/functions/test_ingest_vcf.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ def input_vcf_path(test_data_dir: Path) -> Path:
1111
return test_data_dir / "vcf.vcf"
1212

1313

14-
@pytest.fixture
15-
def client() -> HttpAnyVarClient:
16-
return HttpAnyVarClient()
17-
18-
19-
def test_ingest_vcf(input_vcf_path: Path, client: HttpAnyVarClient):
20-
ingest_vcf(input_vcf_path, client)
14+
@pytest.mark.vcr
15+
def test_ingest_vcf(input_vcf_path: Path, anyvar_client: HttpAnyVarClient):
16+
ingest_vcf(input_vcf_path, anyvar_client)

0 commit comments

Comments
 (0)