Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Port fixes for invalid credential handling #3376

Draft
wants to merge 1 commit into
base: v2-lts
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed an issue where clicking on a file in the Unix System Services tree caused the tree to abruptly change focus to the selected item. [#2486](https://github.com/zowe/zowe-explorer-vscode/issues/2486)
- Fixed an issue where binary USS files were not fetched using the "Pull from Mainframe" context menu option. [#3355](https://github.com/zowe/zowe-explorer-vscode/issues/3355)
- Fixed an issue with Auto Save where a failed UNIX file or data set save operation caused an infinite loop of save requests. [#2406](https://github.com/zowe/zowe-explorer-vscode/issues/2406), [#2627](https://github.com/zowe/zowe-explorer-vscode/issues/2627)
- Fixed an issue where invalid credentials could trigger "Update Credentials" prompt twice in new VS Code session. [#3376](https://github.com/zowe/zowe-explorer-vscode/pull/3376)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add the missing article?: " ... could trigger an Update Credentials prompt ... "

- Fixed an issue where expanding job node to show spool doesn't trigger "Update Credentials" prompt when credentials are invalid. [#3376](https://github.com/zowe/zowe-explorer-vscode/pull/3376)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the missing articles: " ... expanding the job node ... trigger an/the/whatever Update ... "


## `2.18.0`

Expand Down
488 changes: 0 additions & 488 deletions packages/zowe-explorer/__tests__/__unit__/ZoweNode.unit.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe("Tree Provider unit tests, function getTreeItem", () => {
});
});

describe("Tree Provider unit tests, function getTreeItem", () => {
describe("Tree Provider unit tests, function flipState", () => {
it("Testing that expand tree is executed successfully", async () => {
const globalMocks = await createGlobalMocks();
const spy = jest.spyOn(ZoweLogger, "trace");
Expand All @@ -288,14 +288,17 @@ describe("Tree Provider unit tests, function getTreeItem", () => {
session: globalMocks.testSession,
});
folder.contextValue = globals.USS_DIR_CONTEXT;
folder.dirty = false;

// Testing flipState to open
await globalMocks.testUSSTree.flipState(folder, true);
expect(JSON.stringify(folder.iconPath)).toContain("folder-open.svg");
expect(folder.dirty).toBe(false);

// Testing flipState to closed
await globalMocks.testUSSTree.flipState(folder, false);
expect(JSON.stringify(folder.iconPath)).toContain("folder-closed.svg");
expect(folder.dirty).toBe(true);
expect(spy).toBeCalled();
spy.mockClear();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,26 +573,6 @@ describe("Dataset Tree Unit Tests - Function getChildren", () => {

expect(children).toEqual(sampleChildren);
});
it("Checking function for return if element.getChildren is undefined", async () => {
createGlobalMocks();
const blockMocks = createBlockMocks();

mocked(Profiles.getInstance).mockReturnValue(blockMocks.profile);
mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const testTree = new DatasetTree();
testTree.mSessionNodes.push(blockMocks.datasetSessionNode);
const parent = new ZoweDatasetNode({
label: "BRTVS99.PUBLIC",
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
parentNode: testTree.mSessionNodes[1],
});
parent.dirty = true;
jest.spyOn(parent, "getChildren").mockResolvedValueOnce(undefined as any);

const children = await testTree.getChildren(parent);

expect(children).not.toBeDefined();
});
});
describe("Dataset Tree Unit Tests - Function loadProfilesForFavorites", () => {
function createBlockMocks() {
Expand Down Expand Up @@ -1043,17 +1023,17 @@ describe("USSTree Unit Tests - Function addSingleSession", () => {
}

it("Tests that addSingleSession doesn't add the session again, if it was already added", async () => {
await createGlobalMocks();
const blockMocks = await createBlockMocks();
createGlobalMocks();
const blockMocks = createBlockMocks();

await blockMocks.testTree.addSingleSession(blockMocks.testProfile);

expect(blockMocks.testTree.mSessionNodes.length).toEqual(2);
});

it("Tests that addSingleSession successfully adds a session", async () => {
await createGlobalMocks();
const blockMocks = await createBlockMocks();
createGlobalMocks();
const blockMocks = createBlockMocks();

blockMocks.testTree.mSessionNodes.pop();
blockMocks.testSession.ISession.tokenType = blockMocks.testBaseProfile.profile.tokenType;
Expand Down Expand Up @@ -1520,7 +1500,7 @@ describe("Dataset Tree Unit Tests - Function flipState", () => {
});
});
describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
async function createBlockMocks(globalMocks) {
function createBlockMocks(globalMocks) {
const newMocks = {
log: zowe.imperative.Logger.getAppLogger(),
session: createISession(),
Expand Down Expand Up @@ -1556,7 +1536,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {

it("Checking adding of new filter - Theia", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

globalMocks.isTheia.mockReturnValue(true);
mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
Expand All @@ -1572,7 +1552,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking cancelled attempt to add a filter - Theia", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

globalMocks.isTheia.mockReturnValue(true);
mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
Expand All @@ -1587,7 +1567,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking usage of existing filter - Theia", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

globalMocks.isTheia.mockReturnValue(true);
mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("HLQ.PROD1.STUFF"));
Expand All @@ -1603,7 +1583,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking cancelling of filter prompt with available filters - Theia", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

globalMocks.isTheia.mockReturnValue(true);
mocked(vscode.window.showQuickPick).mockResolvedValueOnce(undefined);
Expand All @@ -1618,7 +1598,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking function on favorites", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const testTree = new DatasetTree();
Expand Down Expand Up @@ -1646,7 +1626,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking adding of new filter", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
mocked(vscode.window.showInputBox).mockResolvedValueOnce("HLQ.PROD1.STUFF");
Expand All @@ -1671,7 +1651,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking adding of new filter of multiple ds search", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
mocked(vscode.window.showInputBox).mockResolvedValueOnce("HLQ.PROD(STUF*),HLQ.PROD1*");
Expand Down Expand Up @@ -1699,7 +1679,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking adding of new filter with data set member", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
mocked(vscode.window.showInputBox).mockResolvedValueOnce("HLQ.PROD1(MEMBER)");
Expand All @@ -1712,7 +1692,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking adding of new filter with Unverified profile", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);
Object.defineProperty(Profiles, "getInstance", {
value: jest.fn(() => {
return {
Expand Down Expand Up @@ -1740,7 +1720,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking cancelled attempt to add a filter", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
mocked(vscode.window.showInputBox).mockResolvedValueOnce(undefined);
Expand All @@ -1754,7 +1734,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking usage of existing filter from filterPrompt", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

const quickPickItem = new utils.FilterDescriptor("HLQ.PROD1.STUFF");
mocked(vscode.window.createQuickPick).mockReturnValueOnce(
Expand All @@ -1775,7 +1755,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking cancelling of filter prompt with available filters", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

const quickPickItem = undefined;
mocked(vscode.window.createQuickPick).mockReturnValueOnce(createQuickPickContent("HLQ.PROD1.STUFF", quickPickItem, blockMocks.qpPlaceholder));
Expand All @@ -1793,7 +1773,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking adding of new filter error is caught on getChildren", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
mocked(vscode.window.showInputBox).mockResolvedValueOnce("HLQ.PROD1.STUFF");
Expand All @@ -1815,14 +1795,14 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking function for return if getChildren is undefined", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
mocked(vscode.window.showInputBox).mockResolvedValueOnce("HLQ.PROD1.STUFF");
mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const testTree = new DatasetTree();
testTree.mSessionNodes.push(blockMocks.datasetSessionNode);
Object.defineProperty(testTree.mSessionNodes[1], "getChildren", {
Object.defineProperty(testTree, "getChildren", {
value: jest.fn(() => {
return;
}),
Expand All @@ -1837,7 +1817,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking function for return if element.getChildren calls error handling for success: false", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

const errorSpy = jest.spyOn(utils, "errorHandling");
const debugSpy = jest.spyOn(ZoweLogger, "debug");
Expand Down Expand Up @@ -1866,7 +1846,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
it("Checking function for return if element.getChildren returns undefined", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

mocked(vscode.window.showQuickPick).mockResolvedValueOnce(new utils.FilterDescriptor("\uFF0B " + "Create a new filter"));
mocked(vscode.window.showInputBox).mockResolvedValueOnce("HLQ.PROD1.STUFF");
Expand All @@ -1883,7 +1863,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {

it("updates stats with modified date and user ID if provided in API", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);
const blockMocks = createBlockMocks(globalMocks);

const testTree = new DatasetTree();
testTree.mSessionNodes.push(blockMocks.datasetSessionNode);
Expand Down Expand Up @@ -1923,7 +1903,7 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => {
});
});
describe("Dataset Tree Unit Tests - Function editSession", () => {
async function createBlockMocks() {
function createBlockMocks() {
const newMocks = {
log: zowe.imperative.Logger.getAppLogger(),
session: createISession(),
Expand All @@ -1937,7 +1917,7 @@ describe("Dataset Tree Unit Tests - Function editSession", () => {
mockCheckCurrentProfile: jest.fn(),
};

newMocks.datasetSessionNode = await createDatasetSessionNode(newMocks.session, newMocks.imperativeProfile);
newMocks.datasetSessionNode = createDatasetSessionNode(newMocks.session, newMocks.imperativeProfile);
newMocks.profile = createInstanceOfProfile(newMocks.imperativeProfile);

Object.defineProperty(Profiles, "getInstance", {
Expand Down Expand Up @@ -1966,7 +1946,7 @@ describe("Dataset Tree Unit Tests - Function editSession", () => {

it("Checking common run of function", async () => {
createGlobalMocks();
const blockMocks = await createBlockMocks();
const blockMocks = createBlockMocks();

mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const testTree = new DatasetTree();
Expand Down
Loading
Loading