Commit d1123e21 authored by Lucas Carvalho's avatar Lucas Carvalho

Shadir information can not be overwritten.

It must be possible to append information on shadir files, it must
simulate the real server. Otherwise there is no way to test the behavior
using different signatures.
parent 5a5bff2f
......@@ -548,6 +548,17 @@ class NCHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
pass
else:
data = json.dumps([d])
if os.path.exists(path) and 'shadir' in path:
f = open(path, 'r')
try:
file_data = f.read()
finally:
f.close()
file_data = file_data.strip()
json_data_list = json.loads(file_data)
json_data_list.append(d)
data = json.dumps(json_data_list)
open(path, 'wb').write(data)
self.send_response(201)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment