ilanap | 637206b | 2018-02-04 17:06:22 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2016-2017 European Support Limited |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | const {Then, When, Given} = require('cucumber'); |
| 17 | const assert = require('assert'); |
| 18 | const util = require('./Utils.js'); |
| 19 | |
| 20 | /** |
| 21 | * @module VLM |
| 22 | * @description Creates a new VLM with a random name and saves the id and versionId on the context item object and the context vlm object<br> |
| 23 | * Input data will be taken from the 'resources/json/createVLM.json' file. |
| 24 | *@exampleFile Example_VLM.feature |
| 25 | * @step I want to create a VLM |
| 26 | **/ |
| 27 | When('I want to create a VLM', function() { |
| 28 | let inputData = util.getJSONFromFile('resources/json/createVLM.json'); |
| 29 | inputData.vendorName = util.random(); |
| 30 | let path = '/vendor-license-models'; |
| 31 | return util.request(this.context, 'POST', path, inputData).then(result => { |
| 32 | this.context.item ={id : result.data.itemId, versionId: result.data.version.id}; |
| 33 | this.context.vlm = {id : result.data.itemId, name : inputData.vendorName}; |
| 34 | }); |
| 35 | }); |
| 36 | |
| 37 | /** |
| 38 | * @module VLM |
| 39 | * @exampleFile Example_VLM.feature |
| 40 | * @step I want to submit this VLM |
| 41 | **/ |
| 42 | Then('I want to submit this VLM', function() { |
| 43 | let inputData = {action: 'Submit'}; |
| 44 | let path = '/vendor-license-models/' + this.context.item.id + '/versions/' + this.context.item.versionId + '/actions'; |
| 45 | return util.request(this.context, 'PUT', path, inputData); |
| 46 | }); |
| 47 | |