diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-12-03 18:51:13 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-12-03 20:11:03 +0200 |
commit | 107ffc0a60de703d84957cf6d8948ed7d61d7362 (patch) | |
tree | 624cddece68a78d3f66c3ec02c002e34e7057e3a /yarns/900-implements.yarn | |
parent | dd250d5a64d81ed247ce8e19fc300feaaa1e44c9 (diff) | |
download | ick2-107ffc0a60de703d84957cf6d8948ed7d61d7362.tar.gz |
Add: scenario for testing blob service
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r-- | yarns/900-implements.yarn | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index d08cbc9..6f9d423 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -19,6 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # Scenario step implementations (local and remote instances) +## Data file creation + + IMPLEMENTS WHEN user creates a blob named (\S+) with random data + filename = get_next_match() + n = 16 + blob = os.urandom(n) + write(filename, blob) + ## HTTP requests of various kinds IMPLEMENTS WHEN (\S+) makes request GET (\S+) @@ -32,6 +40,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. vars['headers'] = headers vars['body'] = body + IMPLEMENTS WHEN (\S+) retrieves (\S+) from blob service + user = get_next_match() + path = get_next_match() + token = get_token(user) + url = vars['bsurl'] + status, content_type, headers, body = get(url + path, token) + vars['status_code'] = status + vars['content_type'] = content_type + vars['headers'] = headers + vars['body'] = body + IMPLEMENTS WHEN (\S+) makes request GET (\S+) with an invalid token user = get_next_match() path = get_next_match() @@ -86,6 +105,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. vars['headers'] = headers vars['body'] = body + IMPLEMENTS WHEN (\S+) sends blob (\S+) to blob service as (\S+) + user = get_next_match() + filename = get_next_match() + path = get_next_match() + body = cat(filename) + token = get_token(user) + url = vars['bsurl'] + status, content_type, headers, body = put_blob(url + path, body, token) + vars['status_code'] = status + IMPLEMENTS WHEN (\S+) makes request PUT (\S+) with an invalid token user = get_next_match() path = get_next_match() @@ -130,6 +159,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. actual = vars['body'] assertEqual(expected, actual) + IMPLEMENTS THEN body is the same as the blob (\S+) + filename = get_next_match() + blob = cat(filename) + body = vars['body'] + assertEqual(body, blob) + IMPLEMENTS THEN version in body matches version from setup.py body = vars['body'] obj = json.loads(body) |