diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-11-13 12:35:26 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-11-13 13:19:02 +0200 |
commit | fa6501f87041ca3d3a239988d4b1ae03d7442700 (patch) | |
tree | 1beed5eb44e1939c2702179896cceb52004c16c9 /subplot/server.yaml | |
parent | 2f129dee8841f0007977ba80b1518e94b728d94a (diff) | |
download | obnam2-fa6501f87041ca3d3a239988d4b1ae03d7442700.tar.gz |
refactor: split obnam's bindings, functions for clarity
The old subplot/obnam.{yaml,py} were starting to get large enough that
it was hard to understand them. Also, were partly overlapping in
functionality with runcmd.
Diffstat (limited to 'subplot/server.yaml')
-rw-r--r-- | subplot/server.yaml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/subplot/server.yaml b/subplot/server.yaml new file mode 100644 index 0000000..e7a72b2 --- /dev/null +++ b/subplot/server.yaml @@ -0,0 +1,39 @@ +- given: "a running chunk server" + function: start_chunk_server + cleanup: stop_chunk_server + +- when: "I POST (?P<filename>\\S+) to (?P<path>\\S+), with (?P<header>\\S+): (?P<json>.*)" + regex: true + function: post_file + +- when: "I GET /chunks/<{var}>" + function: get_chunk_via_var + +- when: "I try to GET /chunks/{chunk_id}" + function: get_chunk_by_id + +- when: "I GET /chunks?sha256={sha}" + regex: false + function: find_chunks_with_sha + +- when: "I DELETE /chunks/<{var}>" + function: delete_chunk_via_var + +- when: "I try to DELETE /chunks/{chunk_id}" + function: delete_chunk_by_id + +- then: "HTTP status code is {status}" + function: status_code_is + +- then: "{header} is {value}" + function: header_is + +- then: "the JSON body has a field {field}, henceforth {var}" + function: remember_json_field + +- then: "the JSON body matches (?P<wanted>.*)" + regex: true + function: json_body_matches + +- then: "the body matches file {filename}" + function: body_matches_file |