Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
24 changed files
with
490 additions
and
619 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ on: | |
type: choice | ||
description: The major version tag to update | ||
options: | ||
- v4 | ||
- v5 | ||
- v6 | ||
|
||
jobs: | ||
tag: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 21 additions & 37 deletions
58
__test__/git-config-helper.int.test.ts → __test__/git-auth-helper.int.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,70 @@ | ||
import {GitCommandManager} from '../lib/git-command-manager' | ||
import {GitConfigHelper} from '../lib/git-config-helper' | ||
import {GitAuthHelper} from '../lib/git-auth-helper' | ||
|
||
const REPO_PATH = '/git/local/repos/test-base' | ||
const REPO_PATH = '/git/local/test-base' | ||
|
||
const extraheaderConfigKey = 'http.https://127.0.0.1/.extraheader' | ||
const extraheaderConfigKey = 'http.https://github.com/.extraheader' | ||
|
||
describe('git-config-helper integration tests', () => { | ||
describe('git-auth-helper tests', () => { | ||
let git: GitCommandManager | ||
let gitConfigHelper: GitConfigHelper | ||
let gitAuthHelper: GitAuthHelper | ||
|
||
beforeAll(async () => { | ||
git = await GitCommandManager.create(REPO_PATH) | ||
gitAuthHelper = new GitAuthHelper(git) | ||
}) | ||
|
||
it('tests save and restore with no persisted auth', async () => { | ||
const gitConfigHelper = await GitConfigHelper.create(git) | ||
await gitConfigHelper.close() | ||
await gitAuthHelper.savePersistedAuth() | ||
await gitAuthHelper.restorePersistedAuth() | ||
}) | ||
|
||
it('tests configure and removal of auth', async () => { | ||
const gitConfigHelper = await GitConfigHelper.create(git) | ||
await gitConfigHelper.configureToken('github-token') | ||
await gitAuthHelper.configureToken('github-token') | ||
expect(await git.configExists(extraheaderConfigKey)).toBeTruthy() | ||
expect(await git.getConfigValue(extraheaderConfigKey)).toEqual( | ||
'AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2l0aHViLXRva2Vu' | ||
) | ||
|
||
await gitConfigHelper.close() | ||
await gitAuthHelper.removeAuth() | ||
expect(await git.configExists(extraheaderConfigKey)).toBeFalsy() | ||
}) | ||
|
||
it('tests save and restore of persisted auth', async () => { | ||
const extraheaderConfigValue = 'AUTHORIZATION: basic ***persisted-auth***' | ||
await git.config(extraheaderConfigKey, extraheaderConfigValue) | ||
|
||
const gitConfigHelper = await GitConfigHelper.create(git) | ||
await gitAuthHelper.savePersistedAuth() | ||
|
||
const exists = await git.configExists(extraheaderConfigKey) | ||
expect(exists).toBeFalsy() | ||
|
||
await gitConfigHelper.close() | ||
await gitAuthHelper.restorePersistedAuth() | ||
|
||
const configValue = await git.getConfigValue(extraheaderConfigKey) | ||
expect(configValue).toEqual(extraheaderConfigValue) | ||
|
||
const unset = await git.tryConfigUnset( | ||
extraheaderConfigKey, | ||
'^AUTHORIZATION:' | ||
) | ||
expect(unset).toBeTruthy() | ||
await gitAuthHelper.removeAuth() | ||
}) | ||
|
||
it('tests not adding/removing the safe.directory config when it already exists', async () => { | ||
it('tests adding and removing the safe.directory config', async () => { | ||
await git.config('safe.directory', '/another-value', true, true) | ||
|
||
const gitConfigHelper = await GitConfigHelper.create(git) | ||
|
||
expect( | ||
await git.configExists('safe.directory', '/another-value', true) | ||
).toBeTruthy() | ||
|
||
await gitConfigHelper.close() | ||
|
||
const unset = await git.tryConfigUnset( | ||
'safe.directory', | ||
'/another-value', | ||
true | ||
) | ||
expect(unset).toBeTruthy() | ||
}) | ||
|
||
it('tests adding and removing the safe.directory config', async () => { | ||
const gitConfigHelper = await GitConfigHelper.create(git) | ||
await gitAuthHelper.removeSafeDirectory() | ||
await gitAuthHelper.addSafeDirectory() | ||
|
||
expect( | ||
await git.configExists('safe.directory', REPO_PATH, true) | ||
).toBeTruthy() | ||
|
||
await gitConfigHelper.close() | ||
await gitAuthHelper.addSafeDirectory() | ||
await gitAuthHelper.removeSafeDirectory() | ||
|
||
expect( | ||
await git.configExists('safe.directory', REPO_PATH, true) | ||
).toBeFalsy() | ||
expect( | ||
await git.configExists('safe.directory', '/another-value', true) | ||
).toBeTruthy() | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.