Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

fix: Create default .azure directory if not present #318

Merged
merged 9 commits into from
Sep 10, 2019

Conversation

PIC123
Copy link
Contributor

@PIC123 PIC123 commented Sep 6, 2019

fix: Create default .azure directory if not present

The pluging currently saves credentials from interactive login in the .azure directory by default. If the user doesn't have a .azure directory, current;y the plugin hits an error. This fix checks to make sure the .azure directory exists and creates it if not.

Closes #317

Copy link
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -11,6 +11,9 @@ export class SimpleFileTokenCache implements adal.TokenCache {
private subscriptions: any[] = [];

public constructor(private tokenPath: string = DEFAULT_SLS_TOKEN_FILE) {
if(tokenPath === DEFAULT_SLS_TOKEN_FILE && !fs.existsSync(CONFIG_DIRECTORY)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: spacing - Run auto-format

Copy link
Contributor

@tbarlow12 tbarlow12 left a comment

Choose a reason for hiding this comment

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

LGTM, looks like your tests are failing on Windows, though

@tbarlow12 tbarlow12 force-pushed the phcherne/fix-interactive-login branch from 2c013ca to d9c7aec Compare September 10, 2019 15:34
Copy link
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

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

Let's get the tests fixed first.

@wbreza wbreza force-pushed the phcherne/fix-interactive-login branch from ba288cb to 8fad3a2 Compare September 10, 2019 20:13
Copy link
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

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

Tests are now passing

@PIC123 PIC123 merged commit d5fd387 into dev Sep 10, 2019
@wbreza wbreza deleted the phcherne/fix-interactive-login branch September 12, 2019 20:36
tbarlow12 pushed a commit that referenced this pull request Sep 13, 2019
* Check for .azure directory

* Add test

* Add recursion to make local .azure folder

* Mock os to fix widnows test

* Attempt to fixd windows test with mock

* Fixing tests, still failing to mkdir

* Fix test by resetting filepath in token constructor

* Fix test withmockRestore

* test: Updated token cache tests
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants