Skip to content

Commit f2212d7

Browse files
committed
case intolerance for userid checking
1 parent 4979016 commit f2212d7

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

__tests__/api/BundlePush/BundlePusher.test.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ describe("BundlePusher01", () => {
114114
lstatSpy = jest.spyOn(fs, "lstatSync").mockImplementation(() => ( IS_NOT_DIRECTORY ));
115115
cmciSpy = jest.spyOn(cmci, "getResource").mockImplementation(() => ({ response: { records: {} } }));
116116
consoleText = "";
117-
zosmfProfile = {};
118-
sshProfile = {};
117+
zosmfProfile = { host: "testhost", user: "testuser" };
118+
sshProfile = { host: "testhost", user: "testuser" };
119119
cicsProfile = undefined;
120120
});
121121
afterEach(() => {
@@ -210,29 +210,27 @@ describe("BundlePusher01", () => {
210210
expect(sshSpy).toHaveBeenCalledTimes(1);
211211
});
212212
it("should complain with mismatching zOSMF and SSH profile host names", async () => {
213-
zosmfProfile = { host: "wibble" };
214-
sshProfile = { host: "wobble" };
213+
zosmfProfile = { host: "wibble", user: "user" };
214+
sshProfile = { host: "wobble", user: "user" };
215215

216216
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
217217
"PUSH operation completed.");
218218
expect(consoleText).toContain("WARNING: ssh profile --host value 'wobble' does not match zosmf value 'wibble'.");
219219
});
220220
it("should not complain with matching zOSMF and SSH profile host names", async () => {
221-
zosmfProfile = { host: "wibble" };
222-
sshProfile = { host: "wibble" };
221+
zosmfProfile = { host: "wibble", user: "user" };
222+
sshProfile = { host: "wibble", user: "user" };
223223

224224
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
225225
"PUSH operation completed.");
226226
expect(consoleText).not.toContain("WARNING: ssh profile");
227227
});
228228
it("should complain with mismatching zOSMF and CICS profile host names", async () => {
229-
zosmfProfile = { host: "wibble" };
230-
sshProfile = { host: "wibble" };
231-
cicsProfile = { host: "wobble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
229+
cicsProfile = { host: "wibble", user: "testuser", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
232230

233231
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
234232
"PUSH operation completed.");
235-
expect(consoleText).toContain("WARNING: cics profile --host value 'wobble' does not match zosmf value 'wibble'.");
233+
expect(consoleText).toContain("WARNING: cics profile --host value 'wibble' does not match zosmf value 'testhost'.");
236234
});
237235
it("should not complain with matching zOSMF and CICS profile host names", async () => {
238236
zosmfProfile = { host: "wibble", user: "user" };
@@ -259,6 +257,14 @@ describe("BundlePusher01", () => {
259257
"PUSH operation completed.");
260258
expect(consoleText).not.toContain("WARNING: ssh profile");
261259
});
260+
it("should not complain with matching zOSMF and SSH profile user names - case", async () => {
261+
zosmfProfile = { host: "wibble", user: "fred" };
262+
sshProfile = { host: "wibble", user: "FRED" };
263+
264+
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
265+
"PUSH operation completed.");
266+
expect(consoleText).not.toContain("WARNING: ssh profile");
267+
});
262268
it("should complain with mismatching zOSMF and CICS profile user names", async () => {
263269
zosmfProfile = { host: "wibble", user: "fred" };
264270
sshProfile = { host: "wibble", user: "fred" };

src/api/BundlePush/BundlePusher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export class BundlePusher {
216216
this.issueWarning("ssh profile --host value '" + sshProfile.host + "' does not match zosmf value '" + zosmfProfile.host + "'.");
217217
}
218218
// Do the required profiles share the same user name?
219-
if (zosmfProfile.user !== sshProfile.user) {
219+
if (zosmfProfile.user.toUpperCase() !== sshProfile.user.toUpperCase()) {
220220
this.issueWarning("ssh profile --user value '" + sshProfile.user + "' does not match zosmf value '" + zosmfProfile.user + "'.");
221221
}
222222

@@ -225,12 +225,12 @@ export class BundlePusher {
225225
if (zosmfProfile.host !== cicsProfile.host) {
226226
this.issueWarning("cics profile --host value '" + cicsProfile.host + "' does not match zosmf value '" + zosmfProfile.host + "'.");
227227
}
228-
if (zosmfProfile.user !== cicsProfile.user) {
228+
if (zosmfProfile.user.toUpperCase() !== cicsProfile.user.toUpperCase()) {
229229
this.issueWarning("cics profile --user value '" + cicsProfile.user + "' does not match zosmf value '" + zosmfProfile.user + "'.");
230230
}
231231

232232
// Do the cics-plexes match?
233-
if (this.params.arguments.cicsplex !== cicsProfile.cicsPlex) {
233+
if (cicsProfile.cicsPlex !== undefined && this.params.arguments.cicsplex !== cicsProfile.cicsPlex) {
234234
this.issueWarning("cics profile --cics-plex value '" + cicsProfile.cicsPlex +
235235
"' does not match --cicsplex value '" + this.params.arguments.cicsplex + "'.");
236236
}

0 commit comments

Comments
 (0)