summaryrefslogtreecommitdiff
path: root/yarns/900-implements.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-06-28 08:00:28 +0300
committerLars Wirzenius <liw@liw.fi>2019-07-05 20:59:10 +0300
commit1fc41ad97411b435c512ba3a0de63929eda9c33d (patch)
tree753b342e70c5ac2bf64eb619e95f815d47588e0b /yarns/900-implements.yarn
parent1c6d50edf9041055f4804a1ba21a4fc5499bb0a9 (diff)
downloadick2-1fc41ad97411b435c512ba3a0de63929eda9c33d.tar.gz
Change: make yarns run against a remote Ick instance, not local
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r--yarns/900-implements.yarn37
1 files changed, 33 insertions, 4 deletions
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index 4dcbd8b..92acaa4 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
IMPLEMENTS WHEN (\S+) makes request GET (\S+)
user = get_next_match()
path = get_next_match()
+ path = expand_vars(path, V)
token = get_token(user)
url = V['url']
http(V, get, url + path, token=token)
@@ -40,8 +41,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
user = get_next_match()
path = get_next_match()
token = get_token(user)
- url = V['bsurl']
- http(V, get_blob, url + path, token=token)
+ url = V['url']
+ version = get_version(url)
+ asurl = version['artifact_store']
+ http(V, get_blob, asurl + path, token=token)
+
+ IMPLEMENTS WHEN (\S+) deletes (\S+) from artifact store
+ user = get_next_match()
+ path = get_next_match()
+ token = get_token(user)
+ url = V['url']
+ version = get_version(url)
+ asurl = version['artifact_store']
+ http(V, delete, asurl + path, token=token)
IMPLEMENTS WHEN (\S+) makes request GET (\S+) with an invalid token
user = get_next_match()
@@ -54,6 +66,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
user = get_next_match()
path = get_next_match()
body = get_next_match()
+ body = expand_vars(body, V)
+ V['xxxPOSTbodyvalid'] = body
token = get_token(user)
url = V['url']
http(V, post, url + path, body=body, token=token)
@@ -62,6 +76,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
user = get_next_match()
path = get_next_match()
body = get_next_match()
+ body = expand_vars(body, V)
+ V['xxxPOSTbody'] = body
token = get_token(user)
url = V['url']
http(V, post, url + path, body=body, token='invalid')
@@ -69,7 +85,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
IMPLEMENTS WHEN (\S+) makes request PUT (\S+) with a valid token and body (.+)
user = get_next_match()
path = get_next_match()
+ path = expand_vars(path, V)
body = get_next_match()
+ body = expand_vars(body, V)
+ V['xxxPUTbody'] = body
token = get_token(user)
url = V['url']
http(V, put, url + path, body=body, token=token)
@@ -80,12 +99,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
path = get_next_match()
body = cat(filename)
token = get_token(user)
- url = V['bsurl']
- http(V, put_blob, url + path, body=body, token=token)
+ url = V['url']
+ version = get_version(url)
+ asurl = version['artifact_store']
+ http(V, put_blob, asurl + path, body=body, token=token)
IMPLEMENTS WHEN (\S+) makes request PUT (\S+) with an invalid token
user = get_next_match()
path = get_next_match()
+ path = expand_vars(path, V)
body = '{}'
token = get_token(user)
url = V['url']
@@ -94,18 +116,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
IMPLEMENTS WHEN (\S+) makes request DELETE (\S+)
user = get_next_match()
path = get_next_match()
+ path = expand_vars(path, V)
token = get_token(user)
url = V['url']
http(V, delete, url + path, token=token)
## HTTP response inspection
+ IMPLEMENTS THEN worker id is (\S+)
+ varname = get_next_match()
+ body = json.loads(V['body'])
+ V[varname] = body['worker']
+
IMPLEMENTS THEN result has status code (\d+)
expected = int(get_next_match())
assertEqual(expected, V['status_code'])
IMPLEMENTS THEN body matches (.+)
expected_text = get_next_match()
+ expected_text = expand_vars(expected_text, V)
expected = json.loads(expected_text)
actual = json.loads(V['body'])
print 'expected'