mirror of https://github.com/status-im/consul.git
Add some delete testing to KV and ACL
This commit is contained in:
parent
46419ac466
commit
5e5fffe300
|
@ -0,0 +1,17 @@
|
|||
@setupApplicationTest
|
||||
Feature: dc / acls / delete: ACL Delete
|
||||
Scenario: Delete ACL
|
||||
Given 1 datacenter model with the value "datacenter"
|
||||
And 1 acl model from yaml
|
||||
---
|
||||
Name: something
|
||||
ID: key
|
||||
---
|
||||
When I visit the acls page for yaml
|
||||
---
|
||||
dc: datacenter
|
||||
---
|
||||
And I click actions on the acls
|
||||
And I click delete on the acls
|
||||
And I click confirmDelete on the acls
|
||||
Then a PUT request is made to "/v1/acl/destroy/key?dc=datacenter"
|
|
@ -1,5 +1,5 @@
|
|||
@setupApplicationTest
|
||||
Feature: ACL Update
|
||||
Feature: dc / acls / update: ACL Update
|
||||
Scenario: Update to [Name], [Type], [Rules]
|
||||
Given 1 datacenter model with the value "datacenter"
|
||||
And 1 acl model from yaml
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
@setupApplicationTest
|
||||
Feature: dc / kvs / delete: KV Delete
|
||||
Scenario: Delete ACL
|
||||
Given 1 datacenter model with the value "datacenter"
|
||||
And 1 kv model from yaml
|
||||
---
|
||||
- key-name
|
||||
---
|
||||
When I visit the kvs page for yaml
|
||||
---
|
||||
dc: datacenter
|
||||
---
|
||||
And I click actions on the kvs
|
||||
And I click delete on the kvs
|
||||
And I click confirmDelete on the kvs
|
||||
Then a DELETE request is made to "/v1/kv/key-name?dc=datacenter"
|
|
@ -1,5 +1,5 @@
|
|||
@setupApplicationTest
|
||||
Feature: KV Update
|
||||
Feature: dc / kvs / update: KV Update
|
||||
Scenario: Update to [Name] change value to [Value]
|
||||
Given 1 datacenter model with the value "datacenter"
|
||||
And 1 kv model from yaml
|
||||
|
@ -18,15 +18,18 @@ Feature: KV Update
|
|||
And I submit
|
||||
Then a PUT request is made to "/v1/kv/[Name]?dc=datacenter" with the body "[Value]"
|
||||
Where:
|
||||
------------------------------------
|
||||
--------------------------------------------
|
||||
| Name | Value |
|
||||
# | key | value |
|
||||
# | key-name | a value |
|
||||
| key | value |
|
||||
| key-name | a value |
|
||||
| folder/key-name | a value |
|
||||
------------------------------------
|
||||
# @ignore
|
||||
# Scenario: Rules can be edited/updated
|
||||
# Then ok
|
||||
# @ignore
|
||||
# Scenario: The feedback dialog says success or failure
|
||||
# Then ok
|
||||
--------------------------------------------
|
||||
@ignore
|
||||
Scenario: The feedback dialog says success or failure
|
||||
Then ok
|
||||
@ignore
|
||||
Scenario: KV's with spaces are saved correctly
|
||||
Then ok
|
||||
@ignore
|
||||
Scenario: KV's with returns are saved correctly
|
||||
Then ok
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import steps from '../../steps';
|
||||
|
||||
// step definitions that are shared between features should be moved to the
|
||||
// tests/acceptance/steps/steps.js file
|
||||
|
||||
export default function(assert) {
|
||||
return steps(assert).then('I should find a file', function() {
|
||||
assert.ok(true, this.step);
|
||||
});
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import steps from '../../steps';
|
||||
|
||||
// step definitions that are shared between features should be moved to the
|
||||
// tests/acceptance/steps/steps.js file
|
||||
|
||||
export default function(assert) {
|
||||
return steps(assert).then('I should find a file', function() {
|
||||
assert.ok(true, this.step);
|
||||
});
|
||||
}
|
|
@ -3,9 +3,12 @@ import { create, visitable, collection, attribute, clickable } from 'ember-cli-p
|
|||
import filter from 'consul-ui/tests/pages/components/acl-filter';
|
||||
export default create({
|
||||
visit: visitable('/:dc/acls'),
|
||||
acls: collection('[data-test-acl]', {
|
||||
name: attribute('data-test-acl'),
|
||||
acls: collection('[data-test-tabular-row]', {
|
||||
name: attribute('data-test-acl', '[data-test-acl]'),
|
||||
acl: clickable('a'),
|
||||
actions: clickable('label'),
|
||||
delete: clickable('li:last-child a'),
|
||||
confirmDelete: clickable('button.type-delete'),
|
||||
}),
|
||||
filter: filter,
|
||||
});
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import { create, visitable, collection, attribute } from 'ember-cli-page-object';
|
||||
import { create, visitable, collection, attribute, clickable } from 'ember-cli-page-object';
|
||||
|
||||
export default create({
|
||||
visit: visitable('/:dc/kv'),
|
||||
kvs: collection('[data-test-kv]', {
|
||||
name: attribute('data-test-kv'),
|
||||
kvs: collection('[data-test-tabular-row]', {
|
||||
name: attribute('data-test-kv', '[data-test-kv]'),
|
||||
kv: clickable('a'),
|
||||
actions: clickable('label'),
|
||||
delete: clickable('li:last-child a'),
|
||||
confirmDelete: clickable('button.type-delete'),
|
||||
}),
|
||||
});
|
||||
|
|
|
@ -73,10 +73,18 @@ export default function(assert) {
|
|||
})
|
||||
.when('I click $prop on the $component', function(prop, component) {
|
||||
// Collection
|
||||
var obj;
|
||||
if (typeof currentPage[component].objectAt === 'function') {
|
||||
return currentPage[component].objectAt(0)[prop]();
|
||||
obj = currentPage[component].objectAt(0);
|
||||
} else {
|
||||
return currentPage[component][prop]();
|
||||
obj = currentPage[component];
|
||||
}
|
||||
const func = obj[prop].bind(obj);
|
||||
try {
|
||||
return func();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
throw new Error(`The '${prop}' property on the '${component}' page object doesn't exist`);
|
||||
}
|
||||
})
|
||||
.when('I submit', function(selector) {
|
||||
|
@ -169,6 +177,19 @@ export default function(assert) {
|
|||
`Expected the request body to be ${body} but was ${request.requestBody}`
|
||||
);
|
||||
})
|
||||
.then('a $method request is made to "$url"', function(method, url) {
|
||||
const request = api.server.history[api.server.history.length - 2];
|
||||
assert.equal(
|
||||
request.method,
|
||||
method,
|
||||
`Expected the request method to be ${method} but was ${request.method}`
|
||||
);
|
||||
assert.equal(
|
||||
request.url,
|
||||
url,
|
||||
`Expected the request url to be ${url} but was ${request.url}`
|
||||
);
|
||||
})
|
||||
.then('the url should be $url', function(url) {
|
||||
const current = currentURL();
|
||||
assert.equal(current, url, `Expected the url to be ${url} but was ${current}`);
|
||||
|
|
Loading…
Reference in New Issue