5 def test_001_given_a_target_file_i_want_to_dump_the_adml_context(admlc):
7 requestBody = { "targetFile":"/tmp/context.xml" }
8 responseBodyRef = { "success":"true", "response":"Context dumped on file '/tmp/context.xml'" }
11 response = admlc.postDict("/context", requestBody)
14 admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
16 def test_002_missing_a_target_file_i_want_to_dump_the_adml_context_at_default_location(admlc, mylogger):
18 requestBody = { "targetFile":"" }
19 responseBodyRef = { "success":"true", "response":"Context dumped on file '/tmp/context.xml'" }
22 response = admlc.postDict("/context", requestBody)
24 # Verify response is ok (omit response content because it is informative and have dynamic data (timing)):
25 assert response["status"] == 200
26 assert response["body"]["success"] == "true"
28 body_response = response["body"]["response"]
29 pattern = "Context dumped on file '/var/tmp/anna.context.[0-9]*'"
30 result = re.match(pattern, body_response)
32 mylogger.error("Body response \"" + body_response + "\" does not match the pattern \"" + pattern + "\"")