Skip to content

Commit 8fe0e0a

Browse files
authoredMar 22, 2017
Updates smoke tests to work with temporary credentials (#1421)
* Updates smoke tests to work with temporary credentials * fixes indentation issues
1 parent 73d1c78 commit 8fe0e0a

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed
 

‎features/importexport/importexport.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# language: en
2-
@importexport @requiresakid
2+
@importexport @requiresakid @nosession
33
Feature: AWS Import/Export
44

55
I want to use AWS Import/Export

‎features/s3/step_definitions/objects.js

+30-22
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ module.exports = function () {
102102
});
103103

104104
this.When(/^I get a pre\-signed URL to GET the key "([^"]*)"$/, function(key, callback) {
105-
this.signedUrl = this.s3.getSignedUrl('getObject', {Bucket: this.sharedBucket, Key: key});
106-
callback();
105+
var world = this;
106+
this.s3.getSignedUrl('getObject', {Bucket: this.sharedBucket, Key: key}, function(err, url) {
107+
world.signedUrl = url;
108+
callback();
109+
});
107110
});
108111

109112
this.When(/^I access the URL via HTTP GET$/, function(callback) {
@@ -117,10 +120,13 @@ module.exports = function () {
117120
});
118121

119122
this.Given(/^I get a pre\-signed URL to PUT the key "([^"]*)"(?: with data "([^"]*)")?$/, function(key, body, callback) {
123+
var world = this;
120124
var params = {Bucket: this.sharedBucket, Key: key};
121125
if (body) params.Body = body;
122-
this.signedUrl = this.s3.getSignedUrl('putObject', params);
123-
callback();
126+
this.s3.getSignedUrl('putObject', params, function(err, url) {
127+
world.signedUrl = url;
128+
callback();
129+
});
124130
});
125131

126132
this.Given(/^I access the URL via HTTP PUT with data "([^"]*)"$/, function(body, callback) {
@@ -142,6 +148,7 @@ module.exports = function () {
142148
this.Given(
143149
/^I create a presigned form to POST the key "([^"]*)" with the data "([^"]*)"$/,
144150
function (key, data, callback) {
151+
var world = this;
145152
var boundary = this.postBoundary = '----WebKitFormBoundaryLL0mBKIuuLUKr7be';
146153
var conditions = [
147154
['content-length-range', data.length - 1, data.length + 1]
@@ -151,24 +158,25 @@ module.exports = function () {
151158
Fields: {key: key},
152159
Conditions: conditions
153160
};
154-
var postData = this.s3.createPresignedPost(params);
155-
var body = Object.keys(postData.fields).reduce(function(body, fieldName) {
156-
body += '--' + boundary + '\r\n';
157-
body += 'Content-Disposition: form-data; name="' + fieldName + '"\r\n\r\n';
158-
return body + postData.fields[fieldName] + '\r\n';
159-
}, '');
160-
body += '--' + this.postBoundary + '\r\n';
161-
body += 'Content-Disposition: form-data; name="file"; filename="' + key + '"\r\n';
162-
body += 'Content-Type: text/plain\r\n\r\n';
163-
body += data + '\r\n';
164-
body += '--' + this.postBoundary + '\r\n';
165-
body += 'Content-Disposition: form-data; name="submit"\r\n';
166-
body += 'Content-Type: text/plain\r\n\r\n';
167-
body += 'submit\r\n';
168-
body += '--' + this.postBoundary + '--\r\n';
169-
this.postBody = body;
170-
this.postAction = postData.url;
171-
callback();
161+
this.s3.createPresignedPost(params, function(err, postData) {
162+
var body = Object.keys(postData.fields).reduce(function(body, fieldName) {
163+
body += '--' + boundary + '\r\n';
164+
body += 'Content-Disposition: form-data; name="' + fieldName + '"\r\n\r\n';
165+
return body + postData.fields[fieldName] + '\r\n';
166+
}, '');
167+
body += '--' + world.postBoundary + '\r\n';
168+
body += 'Content-Disposition: form-data; name="file"; filename="' + key + '"\r\n';
169+
body += 'Content-Type: text/plain\r\n\r\n';
170+
body += data + '\r\n';
171+
body += '--' + world.postBoundary + '\r\n';
172+
body += 'Content-Disposition: form-data; name="submit"\r\n';
173+
body += 'Content-Type: text/plain\r\n\r\n';
174+
body += 'submit\r\n';
175+
body += '--' + world.postBoundary + '--\r\n';
176+
world.postBody = body;
177+
world.postAction = postData.url;
178+
callback();
179+
});
172180
}
173181
);
174182

‎features/sts/sts.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Feature: AWS Security Token Service
44

55
I want to use AWS Security Token Service
66

7-
@requiresakid
7+
@requiresakid @nosession
88
Scenario: Get a session token
99
Given I get an STS session token with a duration of 900 seconds
1010
Then the result should contain an access key ID and secret access key

0 commit comments

Comments
 (0)
Please sign in to comment.