Skip to content

Commit

Permalink
feat: user authorization check in tymly.startExecution
Browse files Browse the repository at this point in the history
affects: tymly-test-helpers, tymly, tymly-diaries-plugin, addressbase-plus-blueprint,
addressbase-premium-blueprint, building-blueprint, care-quality-commission-blueprint,
demo-blueprint, food-hygiene-blueprint, heritage-blueprint, indices-multi-deprivation-blueprint,
ofsted-blueprint

Fixing tests so they don't fail for lack of authorization
  • Loading branch information
jezhiggins committed Jun 11, 2018
1 parent 0c64741 commit bbf0d70
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 62 deletions.
9 changes: 5 additions & 4 deletions lib/plugin/components/services/statebox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class StateboxService {
} // if ...

const [authOk, errExecDesc] = await this.authorisationCheck(stateMachineName, executionOptions, 'create')
return authOk ?
this.statebox.startExecution(input, stateMachineName, executionOptions) :
errExecDesc
return authOk
? this.statebox.startExecution(input, stateMachineName, executionOptions)
: errExecDesc
} // startExecution

stopExecution (cause, error, executionName, executionOptions, callback) {
Expand Down Expand Up @@ -116,8 +116,9 @@ class StateboxService {
action
)

if (authorised)
if (authorised) {
return [true]
} // if good ...

return [
false,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"chai-subset": "1.6.0",
"mocha": "5.2.0",
"moment": "2.22.2",
"standard": "11.0.1"
"standard": "11.0.1",
"tymly-test-helpers": "0.0.1"
},
"scripts": {
"lint": "standard",
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions test/fixtures/plugins/say-yes-rbac-plugin/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/generate-uuid-state-resource-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Generate uuid state resource', function () {
],
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/cats-plugin'),
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
(err, tymlyServices) => {
Expand Down
2 changes: 1 addition & 1 deletion test/memory-storage-tymly-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Memory tymly-storage tests', function () {
path.resolve(__dirname, './fixtures/blueprints/storage-blueprint')
],
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
function (err, tymlyServices) {
Expand Down
2 changes: 1 addition & 1 deletion test/registry-state-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('registry key state resources', function () {
path.resolve(__dirname, './fixtures/blueprints/registry-blueprint')
],
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
],
config: {
caches: {
Expand Down
2 changes: 1 addition & 1 deletion test/run-function-state-resource-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Test the run function state resource', function () {
],
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/cats-plugin'),
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
(err, tymlyServices) => {
Expand Down
6 changes: 3 additions & 3 deletions test/run-state-machine-resource-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('run-state-machine state resource test', function () {
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/cats-plugin'),
path.resolve(__dirname, './fixtures/plugins/heartbeat-plugin'),
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
function (err, tymlyServices) {
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('run-state-machine state resource test', function () {
path.resolve(__dirname, './fixtures/blueprints/cats-wrapper-blueprint')
],
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
function (err, tymlyServices) {
Expand Down Expand Up @@ -173,7 +173,7 @@ describe('run-state-machine state resource test', function () {
],
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/justfail-plugin'),
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
function (err, tymlyServices) {
Expand Down
2 changes: 1 addition & 1 deletion test/statebox-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Simple Tymly test', function () {

pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/cats-plugin'),
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
function (err, tymlyServices) {
Expand Down
2 changes: 1 addition & 1 deletion test/timestamp-state-resource-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('timestamp state resources', function () {
path.resolve(__dirname, './fixtures/blueprints/timestamp-blueprint')
],
pluginPaths: [
path.resolve(__dirname, './fixtures/plugins/say-yes-rbac-plugin')
path.resolve(__dirname, '../node_modules/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
},
function (err, tymlyServices) {
Expand Down

0 comments on commit bbf0d70

Please sign in to comment.