Fix tests that do not specify full url

This commit is contained in:
Zachary Eisinger 2019-11-26 13:27:50 -08:00
parent 167e5cb271
commit 09cc69fecb
2 changed files with 15 additions and 15 deletions

View File

@ -29,7 +29,7 @@ const nugetorgNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
const gprnugetorgNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?> const gprnugetorgNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<packageSources> <packageSources>
<add key="GPR" value="https://nuget.pkg.github.com/github/index.json" protocolVersion="3" /> <add key="GPR" value="https://nuget.pkg.github.com/OwnerName/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources> </packageSources>
</configuration>`; </configuration>`;
@ -37,7 +37,7 @@ const gprnugetorgNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
const gprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?> const gprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<packageSources> <packageSources>
<add key="GPR" value="https://nuget.pkg.github.com/github/index.json" protocolVersion="3" /> <add key="GPR" value="https://nuget.pkg.github.com/OwnerName/index.json" protocolVersion="3" />
</packageSources> </packageSources>
</configuration>`; </configuration>`;
@ -52,7 +52,7 @@ const twogprNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
const spaceNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?> const spaceNuGetConfig: string = `<?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<packageSources> <packageSources>
<add key="GPR GitHub" value="https://nuget.pkg.github.com/github/index.json" protocolVersion="3" /> <add key="GPR GitHub" value="https://nuget.pkg.github.com/OwnerName/index.json" protocolVersion="3" />
</packageSources> </packageSources>
</configuration>`; </configuration>`;
@ -94,7 +94,7 @@ describe('authutil tests', () => {
it('No existing config, sets up a full NuGet.config with URL and user/PAT for GPR', async () => { it('No existing config, sets up a full NuGet.config with URL and user/PAT for GPR', async () => {
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN'; process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true); expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect( expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'}) fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@ -104,7 +104,7 @@ describe('authutil tests', () => {
it('No existing config, auth token environment variable not provided, throws', async () => { it('No existing config, auth token environment variable not provided, throws', async () => {
let thrown = false; let thrown = false;
try { try {
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
} catch { } catch {
thrown = true; thrown = true;
} }
@ -114,7 +114,7 @@ describe('authutil tests', () => {
it('No existing config, sets up a full NuGet.config with URL and other owner/PAT for GPR', async () => { it('No existing config, sets up a full NuGet.config with URL and other owner/PAT for GPR', async () => {
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN'; process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
process.env['INPUT_OWNER'] = 'otherorg'; process.env['INPUT_OWNER'] = 'otherorg';
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/otherorg/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true); expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect( expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'}) fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@ -130,7 +130,7 @@ describe('authutil tests', () => {
fs.writeFileSync(inputNuGetConfigPath, invalidNuGetConfig); fs.writeFileSync(inputNuGetConfigPath, invalidNuGetConfig);
let thrown = false; let thrown = false;
try { try {
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
} catch { } catch {
thrown = true; thrown = true;
} }
@ -144,7 +144,7 @@ describe('authutil tests', () => {
'nuget.config' 'nuget.config'
); );
fs.writeFileSync(inputNuGetConfigPath, emptyNuGetConfig); fs.writeFileSync(inputNuGetConfigPath, emptyNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true); expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect( expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'}) fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@ -158,7 +158,7 @@ describe('authutil tests', () => {
'nuget.config' 'nuget.config'
); );
fs.writeFileSync(inputNuGetConfigPath, nugetorgNuGetConfig); fs.writeFileSync(inputNuGetConfigPath, nugetorgNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true); expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect( expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'}) fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@ -172,7 +172,7 @@ describe('authutil tests', () => {
'nuget.config' 'nuget.config'
); );
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig); fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true); expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect( expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'}) fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@ -186,7 +186,7 @@ describe('authutil tests', () => {
'nuget.config' 'nuget.config'
); );
fs.writeFileSync(inputNuGetConfigPath, gprnugetorgNuGetConfig); fs.writeFileSync(inputNuGetConfigPath, gprnugetorgNuGetConfig);
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
expect(fs.existsSync(nugetConfigFile)).toBe(true); expect(fs.existsSync(nugetConfigFile)).toBe(true);
expect( expect(
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'}) fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
@ -216,7 +216,7 @@ describe('authutil tests', () => {
fs.writeFileSync(inputNuGetConfigPath, spaceNuGetConfig); fs.writeFileSync(inputNuGetConfigPath, spaceNuGetConfig);
let thrown = false; let thrown = false;
try { try {
await auth.configAuthentication('https://nuget.pkg.github.com'); await auth.configAuthentication('https://nuget.pkg.github.com/OwnerName/index.json');
} catch { } catch {
thrown = true; thrown = true;
} }
@ -236,7 +236,7 @@ describe('authutil tests', () => {
fs.mkdirSync(inputNuGetConfigDirectory, {recursive: true}); fs.mkdirSync(inputNuGetConfigDirectory, {recursive: true});
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig); fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
await auth.configAuthentication( await auth.configAuthentication(
'https://nuget.pkg.github.com', 'https://nuget.pkg.github.com/OwnerName/index.json',
'subfolder/nuget.config' 'subfolder/nuget.config'
); );
expect(fs.existsSync(nugetConfigFile)).toBe(true); expect(fs.existsSync(nugetConfigFile)).toBe(true);

View File

@ -29,8 +29,8 @@ describe('installer tests', () => {
}, 100000); }, 100000);
it('Acquires version of dotnet if no matching version is installed', async () => { it('Acquires version of dotnet if no matching version is installed', async () => {
await getDotnet('2.2.104'); await getDotnet('2.2.205');
const dotnetDir = path.join(toolDir, 'dncs', '2.2.104', os.arch()); const dotnetDir = path.join(toolDir, 'dncs', '2.2.205', os.arch());
expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true); expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true);
if (IS_WINDOWS) { if (IS_WINDOWS) {