Skip to content

Commit 8a6d2c5

Browse files
Yogesh NaikYogesh Naik
authored andcommitted
Removed mocking to re-produce issue
1 parent 5a45af4 commit 8a6d2c5

File tree

2 files changed

+184
-11
lines changed

2 files changed

+184
-11
lines changed

test/just_testing_ignore_me.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
## Interaction 0: GET /climateweb/rest/v1/country/annualavg/pr/1980/1999/fra.xml
2+
3+
### Request headers recorded for playback:
4+
5+
```
6+
Host: climatedataapi.worldbank.org
7+
User-Agent: Servirtium-Testing
8+
Accept-Encoding: gzip, deflate
9+
Accept: */*
10+
Connection: keep-alive
11+
```
12+
13+
### Request body recorded for playback ():
14+
15+
```
16+
17+
18+
```
19+
20+
### Response headers recorded for playback:
21+
22+
```
23+
Date: Sun, 27 Dec 2020 06:15:10 GMT
24+
Content-Type: application/xml
25+
Connection: keep-alive
26+
Set-Cookie: AWSALB=/Meqov8TdiMxCH7QcSG4dT5QGn7jXugp4sTr4w4eok9Vozamj5IFjCeALlrea8wNZvt7I0Ld9JD/c5fV25FfHb91HHCIniwAhNLL8TaoUJtTFLKdCDq1u2y2p9CG; Expires=Sun, 03 Jan 2021 06:15:10 GMT; Path=/, AWSALBCORS=/Meqov8TdiMxCH7QcSG4dT5QGn7jXugp4sTr4w4eok9Vozamj5IFjCeALlrea8wNZvt7I0Ld9JD/c5fV25FfHb91HHCIniwAhNLL8TaoUJtTFLKdCDq1u2y2p9CG; Expires=Sun, 03 Jan 2021 06:15:10 GMT; Path=/; SameSite=None; Secure, climatedata.cookie=2093065738.64288.0000; path=/; Httponly; Secure, TS01c35ec3=010f7a2ab0a4da9f374f75dfe8ffde83f717ac592ded1ef1a617f814b13e84b39afd277b374e0cfe5c15fabd93227f3d099c978bef72ff9f903c96a3de78014cc9b4c68db6; Path=/, climatedataapi.cookie=2631971082.33060.0000; path=/; Httponly, climatedataapi_ext.cookie=2543958026.20480.0000; path=/; Httponly, TS0137860d=01359ee9766df4755a68a1bad9e1054b7060b9d1260bd249880de6b80d30bdb715285f9590b6922530481277a42d265918cf78d346f9736be1abc4686b8c8d8cd46eea022bdd0d7fa4788e93635c13b7428e38d906e13c8f6ce5759dde49970ee2fb4830cd32253e50dfc466d7de7e696b93ccac8e94229d64190cc6ea2c57a81cc3b37c544e77ce7db3b4e91755e16cec6367e1f9; Path=/
27+
Access-Control-Allow-Origin: *
28+
Access-Control-Allow-Headers: X-Requested-With
29+
Access-Control-Allow-Methods: GET
30+
Strict-Transport-Security: max-age=31536000; includeSubDomains
31+
X-XSS-Protection: 1; mode=block
32+
X-Content-Type-Options: nosniff
33+
Content-Security-Policy: default-src 'self'
34+
X-Frame-Options: deny
35+
Cache-Control: no-cache,no-store
36+
Pragma: no-cache
37+
Secure: true
38+
HttpOnly: true
39+
Transfer-Encoding: chunked
40+
```
41+
42+
### Response body recorded for playback (200: application/xml):
43+
44+
```
45+
<list>
46+
<domain.web.AnnualGcmDatum>
47+
<gcm>bccr_bcm2_0</gcm>
48+
<variable>pr</variable>
49+
<fromYear>1980</fromYear>
50+
<toYear>1999</toYear>
51+
<annualData>
52+
<double>1077.8620827419693</double>
53+
</annualData>
54+
</domain.web.AnnualGcmDatum>
55+
<domain.web.AnnualGcmDatum>
56+
<gcm>cccma_cgcm3_1</gcm>
57+
<variable>pr</variable>
58+
<fromYear>1980</fromYear>
59+
<toYear>1999</toYear>
60+
<annualData>
61+
<double>745.3185434053028</double>
62+
</annualData>
63+
</domain.web.AnnualGcmDatum>
64+
<domain.web.AnnualGcmDatum>
65+
<gcm>cnrm_cm3</gcm>
66+
<variable>pr</variable>
67+
<fromYear>1980</fromYear>
68+
<toYear>1999</toYear>
69+
<annualData>
70+
<double>1063.867595326212</double>
71+
</annualData>
72+
</domain.web.AnnualGcmDatum>
73+
<domain.web.AnnualGcmDatum>
74+
<gcm>csiro_mk3_5</gcm>
75+
<variable>pr</variable>
76+
<fromYear>1980</fromYear>
77+
<toYear>1999</toYear>
78+
<annualData>
79+
<double>1007.0295299183938</double>
80+
</annualData>
81+
</domain.web.AnnualGcmDatum>
82+
<domain.web.AnnualGcmDatum>
83+
<gcm>gfdl_cm2_0</gcm>
84+
<variable>pr</variable>
85+
<fromYear>1980</fromYear>
86+
<toYear>1999</toYear>
87+
<annualData>
88+
<double>1061.3426458178785</double>
89+
</annualData>
90+
</domain.web.AnnualGcmDatum>
91+
<domain.web.AnnualGcmDatum>
92+
<gcm>gfdl_cm2_1</gcm>
93+
<variable>pr</variable>
94+
<fromYear>1980</fromYear>
95+
<toYear>1999</toYear>
96+
<annualData>
97+
<double>1004.4105613005454</double>
98+
</annualData>
99+
</domain.web.AnnualGcmDatum>
100+
<domain.web.AnnualGcmDatum>
101+
<gcm>ingv_echam4</gcm>
102+
<variable>pr</variable>
103+
<fromYear>1980</fromYear>
104+
<toYear>1999</toYear>
105+
<annualData>
106+
<double>750.6408894859092</double>
107+
</annualData>
108+
</domain.web.AnnualGcmDatum>
109+
<domain.web.AnnualGcmDatum>
110+
<gcm>inmcm3_0</gcm>
111+
<variable>pr</variable>
112+
<fromYear>1980</fromYear>
113+
<toYear>1999</toYear>
114+
<annualData>
115+
<double>967.5554180724546</double>
116+
</annualData>
117+
</domain.web.AnnualGcmDatum>
118+
<domain.web.AnnualGcmDatum>
119+
<gcm>ipsl_cm4</gcm>
120+
<variable>pr</variable>
121+
<fromYear>1980</fromYear>
122+
<toYear>1999</toYear>
123+
<annualData>
124+
<double>873.0839862248788</double>
125+
</annualData>
126+
</domain.web.AnnualGcmDatum>
127+
<domain.web.AnnualGcmDatum>
128+
<gcm>miroc3_2_medres</gcm>
129+
<variable>pr</variable>
130+
<fromYear>1980</fromYear>
131+
<toYear>1999</toYear>
132+
<annualData>
133+
<double>903.9068381571817</double>
134+
</annualData>
135+
</domain.web.AnnualGcmDatum>
136+
<domain.web.AnnualGcmDatum>
137+
<gcm>miub_echo_g</gcm>
138+
<variable>pr</variable>
139+
<fromYear>1980</fromYear>
140+
<toYear>1999</toYear>
141+
<annualData>
142+
<double>911.8733705463638</double>
143+
</annualData>
144+
</domain.web.AnnualGcmDatum>
145+
<domain.web.AnnualGcmDatum>
146+
<gcm>mpi_echam5</gcm>
147+
<variable>pr</variable>
148+
<fromYear>1980</fromYear>
149+
<toYear>1999</toYear>
150+
<annualData>
151+
<double>807.6978963218183</double>
152+
</annualData>
153+
</domain.web.AnnualGcmDatum>
154+
<domain.web.AnnualGcmDatum>
155+
<gcm>mri_cgcm2_3_2a</gcm>
156+
<variable>pr</variable>
157+
<fromYear>1980</fromYear>
158+
<toYear>1999</toYear>
159+
<annualData>
160+
<double>643.4242285526061</double>
161+
</annualData>
162+
</domain.web.AnnualGcmDatum>
163+
<domain.web.AnnualGcmDatum>
164+
<gcm>ukmo_hadcm3</gcm>
165+
<variable>pr</variable>
166+
<fromYear>1980</fromYear>
167+
<toYear>1999</toYear>
168+
<annualData>
169+
<double>911.9471435543941</double>
170+
</annualData>
171+
</domain.web.AnnualGcmDatum>
172+
<domain.web.AnnualGcmDatum>
173+
<gcm>ukmo_hadgem1</gcm>
174+
<variable>pr</variable>
175+
<fromYear>1980</fromYear>
176+
<toYear>1999</toYear>
177+
<annualData>
178+
<double>977.019703258182</double>
179+
</annualData>
180+
</domain.web.AnnualGcmDatum>
181+
</list>
182+
```

test/test_recorder.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,7 @@
66
from definitions import MOCKS_DIR
77

88

9-
@patch('servirtium.recorder.RecorderHttpHandler.perform_request_on_real_service')
10-
def test_something(mock_perform_request_on_real_service):
11-
mock_perform_request_on_real_service.return_value = AttrDict({
12-
"status_code": 200,
13-
"content": str.encode("something wonderful has happened", encoding="utf-8"),
14-
"headers": {
15-
"Content-Type": "text/plain",
16-
"a": "1"
17-
}
18-
})
9+
def test_something():
1910
# servirtium_site = "http://localhost:61417"
2011

2112
recorder.set_real_service('http://climatedataapi.worldbank.org')
@@ -27,7 +18,7 @@ def test_something(mock_perform_request_on_real_service):
2718

2819
recorder.RecorderHttpHandler.set_markdown_filename("just_testing_ignore_me")
2920

30-
rsp = requests.get("http://localhost:61417/abc/123")
21+
rsp = requests.get('http://localhost:61417/climateweb/rest/v1/country/annualavg/pr/1980/1999/fra.xml')
3122

3223
assert rsp.content.decode(encoding="utf-8") == "something wonderful has happened"
3324

0 commit comments

Comments
 (0)