Skip to content

Commit

Permalink
Merge pull request #148 from screwdriver-cd/update_pipeline
Browse files Browse the repository at this point in the history
fix(562): Add schema for updating a pipeline
  • Loading branch information
d2lam authored Jun 20, 2017
2 parents dede5da + 574e094 commit 5e32658
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions models/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ module.exports = {
*/
create: Joi.object(CHECKOUT_URL).label('Create Pipeline'),

/**
* Properties for Pipeline that will be passed during an UPDATE request
*
* @property update
* @type {Joi}
*/
update: Joi.object(CHECKOUT_URL).label('Update Pipeline'),

/**
* List of fields that determine a unique row
*
Expand Down
2 changes: 2 additions & 0 deletions test/data/pipeline.update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Pipeline Create Example
checkoutUrl: git@github.com:screwdriver-cd/data-schema.git#branch
10 changes: 10 additions & 0 deletions test/models/pipeline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@ describe('model pipeline', () => {
assert.isNotNull(validate('empty.yaml', models.pipeline.get).error);
});
});

describe('update', () => {
it('validates the update', () => {
assert.isNull(validate('pipeline.update.yaml', models.pipeline.update).error);
});

it('fails the update', () => {
assert.isNotNull(validate('empty.yaml', models.pipeline.update).error);
});
});
});

0 comments on commit 5e32658

Please sign in to comment.