6
6
from PIL import Image
7
7
8
8
9
- def test_search_studies (httpserver , client , cache_dir ):
10
- cache_filename = os .path .join (cache_dir , 'search_studies .json' )
9
+ def test_search_for_studies (httpserver , client , cache_dir ):
10
+ cache_filename = os .path .join (cache_dir , 'search_for_studies .json' )
11
11
with open (cache_filename , 'r' ) as f :
12
12
content = f .read ()
13
13
parsed_content = json .loads (content )
14
14
headers = {'content-type' : 'application/dicom+json' }
15
15
httpserver .serve_content (content = content , code = 200 , headers = headers )
16
- assert client .search_studies () == parsed_content
16
+ assert client .search_for_studies () == parsed_content
17
17
request = httpserver .requests [0 ]
18
18
assert request .path == '/studies'
19
19
assert request .accept_mimetypes == [('application/dicom+json' , 1 )]
20
20
21
21
22
- def test_search_studies_limit_offset (httpserver , client , cache_dir ):
23
- cache_filename = os .path .join (cache_dir , 'search_studies .json' )
22
+ def test_search_for_studies_limit_offset (httpserver , client , cache_dir ):
23
+ cache_filename = os .path .join (cache_dir , 'search_for_studies .json' )
24
24
with open (cache_filename , 'r' ) as f :
25
25
data = json .loads (f .read ())
26
26
# We will limit the search to 2 studies starting with the 2nd.
27
27
content = json .dumps (data [1 :3 ])
28
28
parsed_content = json .loads (content )
29
29
headers = {'content-type' : 'application/dicom+json' }
30
30
httpserver .serve_content (content = content , code = 200 , headers = headers )
31
- assert client .search_studies (limit = 2 , offset = 1 ) == parsed_content
31
+ assert client .search_for_studies (limit = 2 , offset = 1 ) == parsed_content
32
32
request = httpserver .requests [0 ]
33
33
assert (
34
34
request .query_string .decode () == 'limit=2&offset=1' or
@@ -38,28 +38,28 @@ def test_search_studies_limit_offset(httpserver, client, cache_dir):
38
38
assert request .accept_mimetypes == [('application/dicom+json' , 1 )]
39
39
40
40
41
- def test_search_series (httpserver , client , cache_dir ):
42
- cache_filename = os .path .join (cache_dir , 'search_series .json' )
41
+ def test_search_for_series (httpserver , client , cache_dir ):
42
+ cache_filename = os .path .join (cache_dir , 'search_for_series .json' )
43
43
with open (cache_filename , 'r' ) as f :
44
44
content = f .read ()
45
45
parsed_content = json .loads (content )
46
46
headers = {'content-type' : 'application/dicom+json' }
47
47
httpserver .serve_content (content = content , code = 200 , headers = headers )
48
- assert client .search_series () == parsed_content
48
+ assert client .search_for_series () == parsed_content
49
49
request = httpserver .requests [0 ]
50
50
assert request .path == '/series'
51
51
assert request .accept_mimetypes == [('application/dicom+json' , 1 )]
52
52
53
53
54
- def test_search_series_limit_offset (httpserver , client , cache_dir ):
55
- cache_filename = os .path .join (cache_dir , 'search_series .json' )
54
+ def test_search_for_series_limit_offset (httpserver , client , cache_dir ):
55
+ cache_filename = os .path .join (cache_dir , 'search_for_series .json' )
56
56
with open (cache_filename , 'r' ) as f :
57
57
data = json .loads (f .read ())
58
58
content = json .dumps (data [1 :3 ])
59
59
parsed_content = json .loads (content )
60
60
headers = {'content-type' : 'application/dicom+json' }
61
61
httpserver .serve_content (content = content , code = 200 , headers = headers )
62
- assert client .search_studies (limit = 2 , offset = 1 ) == parsed_content
62
+ assert client .search_for_studies (limit = 2 , offset = 1 ) == parsed_content
63
63
request = httpserver .requests [0 ]
64
64
assert (
65
65
request .query_string .decode () == 'limit=2&offset=1' or
@@ -69,27 +69,27 @@ def test_search_series_limit_offset(httpserver, client, cache_dir):
69
69
assert request .accept_mimetypes == [('application/dicom+json' , 1 )]
70
70
71
71
72
- def test_search_instances (httpserver , client , cache_dir ):
73
- cache_filename = os .path .join (cache_dir , 'search_instances .json' )
72
+ def test_search_for_instances (httpserver , client , cache_dir ):
73
+ cache_filename = os .path .join (cache_dir , 'search_for_instances .json' )
74
74
with open (cache_filename , 'r' ) as f :
75
75
content = f .read ()
76
76
parsed_content = json .loads (content )
77
77
headers = {'content-type' : 'application/dicom+json' }
78
78
httpserver .serve_content (content = content , code = 200 , headers = headers )
79
- assert client .search_instances () == parsed_content
79
+ assert client .search_for_instances () == parsed_content
80
80
request = httpserver .requests [0 ]
81
81
assert request .path == '/instances'
82
82
assert request .accept_mimetypes == [('application/dicom+json' , 1 )]
83
83
84
84
85
- def test_search_instances_limit_offset (httpserver , client , cache_dir ):
86
- cache_filename = os .path .join (cache_dir , 'search_instances .json' )
85
+ def test_search_for_instances_limit_offset (httpserver , client , cache_dir ):
86
+ cache_filename = os .path .join (cache_dir , 'search_for_instances .json' )
87
87
with open (cache_filename , 'r' ) as f :
88
88
content = f .read ()
89
89
parsed_content = json .loads (content )
90
90
headers = {'content-type' : 'application/dicom+json' }
91
91
httpserver .serve_content (content = content , code = 200 , headers = headers )
92
- assert client .search_instances (limit = 2 , offset = 1 ) == parsed_content
92
+ assert client .search_for_instances (limit = 2 , offset = 1 ) == parsed_content
93
93
request = httpserver .requests [0 ]
94
94
assert (
95
95
request .query_string .decode () == 'limit=2&offset=1' or
@@ -99,12 +99,12 @@ def test_search_instances_limit_offset(httpserver, client, cache_dir):
99
99
assert request .accept_mimetypes == [('application/dicom+json' , 1 )]
100
100
101
101
102
- def test_search_instances_includefields (httpserver , client , cache_dir ):
102
+ def test_search_for_instances_includefields (httpserver , client , cache_dir ):
103
103
headers = {'content-type' : 'application/dicom+json' }
104
104
httpserver .serve_content (content = '' , code = 200 , headers = headers )
105
105
f1 = 'StudyInstanceUID'
106
106
f2 = 'SeriesInstanceUID'
107
- client .search_instances (fields = {f1 , f2 })
107
+ client .search_for_instances (fields = {f1 , f2 })
108
108
request = httpserver .requests [0 ]
109
109
query_string_opt_1 = 'includefield={}&includefield={}' .format (f1 , f2 )
110
110
query_string_opt_2 = 'includefield={}&includefield={}' .format (f2 , f1 )
0 commit comments