blob: a24a90b0a5075573578ca63e2b599b1295f7bc29 [file] [log] [blame]
ilanap637206b2018-02-04 17:06:22 +02001/*
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 */
16const {Then, When} = require('cucumber');
17const assert = require('assert');
18const util = require('./Utils.js');
19
20
21/**
22 * @module VF
23 * @description Creates a VF for this Item (does NOT work on localhost). will get the data for the item and then update the input
24 * data for the VF call.
25 * @exampleFile Example_VSP.feature
26 * @step I want to create a VF for this Item
27 **/
28Then('I want to create a VF for this Item', function () {
29 return util.request(this.context, 'GET', '/vendor-software-products/' + this.context.item.id + '/versions/' + this.context.item.versionId).then(result => {
30 this.context.inputData = util.getJSONFromFile('resources/json/createVF.json');
31 // start replacing stuff
ilanape5d23232019-01-30 12:50:04 +020032 this.context.inputData.contactId = this.context.headers['catalog']["USER_ID"];
ilanap637206b2018-02-04 17:06:22 +020033 this.context.inputData.categories[0].uniqueId = result.data.category;
34 this.context.inputData.categories[0].subcategories[0].uniqueId = result.data.subCategory;
35 this.context.inputData.description = result.data.description;
36 this.context.inputData.name = result.data.name;
37 this.context.inputData.tags[0] = result.data.name;
38 this.context.inputData.vendorName = result.data.vendorName;
39 this.context.inputData.csarUUID = this.context.item.id;
ilanape5d23232019-01-30 12:50:04 +020040 return util.request(this.context, 'POST', '/catalog/resources', this.context.inputData, false, 'catalog');
ilanap637206b2018-02-04 17:06:22 +020041 });
42});
43