-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathiProdFunctional.js
More file actions
184 lines (159 loc) · 7.93 KB
/
iProdFunctional.js
File metadata and controls
184 lines (159 loc) · 7.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// Copyright (c) International Business Machines Corp. 2019
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
// associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* eslint-disable new-cap */
const { expect } = require('chai');
const { iConn, iProd } = require('../../../lib/itoolkit');
const { config, printConfig } = require('../config');
// deprecated tests are in place to test compatability using deprecated classes and functions
// these tests use deprecated iConn Class to create a connnection
// iConn only supported idb and rest transports
if (config.transport !== 'idb' && config.transport !== 'rest') {
throw new Error('Only idb and rest transports are available for deprecated tests');
}
const {
database, username, password, host, port = 80, path,
} = config.transportOptions;
let restOptions = null;
if (config.transport === 'rest') {
restOptions = {
host,
port,
path,
};
}
let deprecation = null;
function deprecationHandler(dep) {
deprecation = dep;
}
function getDeprecation() {
const temp = deprecation;
deprecation = null;
return temp;
}
describe('iProd Functional Tests', function () {
before(function () {
printConfig();
process.on('deprecation', deprecationHandler);
});
after(function () {
process.removeAllListeners('deprecation', deprecationHandler);
});
describe('constructor', function () {
it('creates and returns an instance of iProd', function () {
const connection = new iConn(database, config.user, password);
const prod = new iProd(connection);
expect(prod).to.be.instanceOf(iProd);
expect(getDeprecation().message).to
.equal("As of v1.0, class 'iProd' is deprecated and will be removed at a later time.");
});
});
describe('getPTFInfo', function () {
it('returns info for specified ptf', function (done) {
const connection = new iConn(database, username, password, restOptions);
const prod = new iProd(connection);
prod.getPTFInfo('SI67726', (ptf) => {
expect(getDeprecation().message).to
.equal("As of v1.0, 'iProd.getPTFInfo()' is deprecated and will be removed at a later time");
expect(ptf).to.be.an('Object');
expect(ptf).to.have.a.property('Product_ID');
expect(ptf).to.have.a.property('PTF_ID');
expect(ptf).to.have.a.property('Release_level');
expect(ptf).to.have.a.property('Product_option');
expect(ptf).to.have.a.property('Load_ID');
expect(ptf).to.have.a.property('Loaded_status');
expect(ptf).to.have.a.property('Cover_letter_status');
expect(ptf).to.have.a.property('On-order_status');
expect(ptf).to.have.a.property('Save_file_status');
expect(ptf).to.have.a.property('File_name');
expect(ptf).to.have.a.property('File_library_name');
expect(ptf).to.have.a.property('PTF_type');
expect(ptf).to.have.a.property('IPL_action');
expect(ptf).to.have.a.property('Action_pending');
expect(ptf).to.have.a.property('Action_required');
expect(ptf).to.have.a.property('PTF_is_released');
expect(ptf).to.have.a.property('Target_release');
expect(ptf).to.have.a.property('Superseding_PTF');
expect(ptf).to.have.a.property('Current_IPL_source');
expect(ptf).to.have.a.property('Minimum_level');
expect(ptf).to.have.a.property('Maximum_level');
expect(ptf).to.have.a.property('Format_information_available');
expect(ptf).to.have.a.property('Status_date_and_time');
expect(ptf).to.have.a.property('Licensed_Internal_Code_group');
expect(ptf).to.have.a.property('Superseded_by_PTF_ID');
expect(ptf).to.have.a.property('Current_server_IPL_source');
expect(ptf).to.have.a.property('Server_IPL_required');
expect(ptf).to.have.a.property('Creation_date_and_time');
expect(ptf).to.have.a.property('Technology_refresh_PTF');
done();
});
});
});
describe('getProductInfo', function () {
it('returns info for specified product', function (done) {
const connection = new iConn(database, username, password, restOptions);
const prod = new iProd(connection);
prod.getProductInfo('5770DG1', (product) => {
expect(getDeprecation().message).to
.equal("As of v1.0, 'iProd.getProductInfo()' is deprecated and will be removed at a later time");
expect(product).to.be.an('Object');
expect(product).to.have.a.property('Product_ID');
expect(product).to.have.a.property('Release_level');
expect(product).to.have.a.property('Product_option');
expect(product).to.have.a.property('Load_ID');
expect(product).to.have.a.property('Symbolic_load_state');
expect(product).to.have.a.property('Load_error_indicator');
expect(product).to.have.a.property('Load_state');
expect(product).to.have.a.property('Supported_flag');
expect(product).to.have.a.property('Registration_type');
expect(product).to.have.a.property('Registration_value');
expect(product).to.have.a.property('Offset_to_additional_information');
expect(product).to.have.a.property('Primary_language_load_identifier');
expect(product).to.have.a.property('Minimum_target_release');
expect(product).to.have.a.property('Minimum_VRM_of_*BASE_required_by_option');
expect(product).to.have.a.property('Requirements_met_between_base_and_option_value');
expect(product).to.have.a.property('Level');
done();
});
});
});
// REST transport currently failing with 414 URI Too Long response code
// The requested URL's length exceeds the capacity limit for this server
describe('getInstalledProducts', function () {
it('returns info for installed products', function (done) {
const connection = new iConn(database, username, password, restOptions);
const prod = new iProd(connection);
prod.getInstalledProducts((products) => {
expect(getDeprecation().message).to
.equal("As of v1.0, 'iProd.getInstalledProducts()' is deprecated and will be removed at a later time");
expect(products).to.be.an('Array');
expect(products.length).to.be.greaterThan(0);
products.forEach((product) => {
expect(product).to.be.an('Object');
expect(product).to.have.a.property('Product_ID');
expect(product).to.have.a.property('Product_option');
expect(product).to.have.a.property('Release_level');
expect(product).to.have.a.property('Description_text_message_ID');
expect(product).to.have.a.property('Description_text_object_name');
expect(product).to.have.a.property('Description_text_library_name');
expect(product).to.have.a.property('Installed_flag');
expect(product).to.have.a.property('Supported_flag');
expect(product).to.have.a.property('Registration_type');
expect(product).to.have.a.property('Registration_value');
expect(product).to.have.a.property('Description_text');
});
done();
});
});
});
});