2022-01-11 11:02:46 +00:00
|
|
|
export default function(scenario, respondWith, set, oidc) {
|
2019-02-21 13:05:05 +00:00
|
|
|
// respondWith should set the url to return a certain response shape
|
|
|
|
scenario
|
2020-01-24 12:26:28 +00:00
|
|
|
.given(['the url "$endpoint" responds with a $status status'], function(url, status) {
|
2019-02-21 13:05:05 +00:00
|
|
|
respondWith(url, {
|
|
|
|
status: parseInt(status),
|
|
|
|
});
|
|
|
|
})
|
2020-01-24 12:26:28 +00:00
|
|
|
.given(['the url "$endpoint" responds with from yaml\n$yaml'], function(url, data) {
|
2021-02-19 16:42:16 +00:00
|
|
|
if (typeof data.body !== 'string') {
|
|
|
|
data.body = JSON.stringify(data.body);
|
|
|
|
}
|
2019-02-21 13:05:05 +00:00
|
|
|
respondWith(url, data);
|
|
|
|
})
|
2022-01-11 11:02:46 +00:00
|
|
|
.given(['the "$provider" oidcProvider responds with from yaml\n$yaml'], function(name, data) {
|
|
|
|
oidc(name, data);
|
|
|
|
})
|
2019-02-21 13:05:05 +00:00
|
|
|
.given('a network latency of $number', function(number) {
|
|
|
|
set('CONSUL_LATENCY', number);
|
|
|
|
});
|
|
|
|
}
|