-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add clean tokens for gitlab CI and more tests (#34)
- Loading branch information
Showing
5 changed files
with
81 additions
and
3 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
29 changes: 29 additions & 0 deletions
29
src/Agoda.DevFeedback.CommonTests/Agoda.DevFeedback.Common.Tests.csproj
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
|
||
<ItemGroup> | ||
<PackageReference Include="Agoda.Analyzers" Version="1.0.523"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||
<PackageReference Include="NSubstitute" Version="4.2.2" /> | ||
<PackageReference Include="nunit" Version="3.13.2" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" /> | ||
<PackageReference Include="Shouldly" Version="4.2.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Agoda.DevFeedback.Common\Agoda.DevFeedback.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
32 changes: 32 additions & 0 deletions
32
src/Agoda.DevFeedback.CommonTests/GitContextReaderTests.cs
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Agoda.DevFeedback.Common; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using NUnit.Framework; | ||
using Shouldly; | ||
|
||
namespace Agoda.DevFeedback.Common.Tests | ||
{ | ||
[TestFixture()] | ||
public class GitContextReaderTests | ||
{ | ||
[Test()] | ||
[TestCase("https://gitlab-ci-token:[email protected]/full-stack/ycs/revenue-management", "64_-_v7W68Q4uMG1sXIeh-W")] | ||
// Note: this is not a real token, it is just a random string | ||
public void WhenUrlHasToken_ShouldCleanTokenFromUrl(string url, string token) | ||
{ | ||
var result = GitContextReader.CleanGitlabCIToken(url); | ||
result.ShouldNotContain(token); | ||
result.ShouldNotContain("@"); | ||
result.ShouldNotContain("gitlab-ci-token:"); | ||
} | ||
|
||
[Test()] | ||
[TestCase("https://gitlab.agodadev.io/full-stack/ycs/revenue-management")] | ||
public void WhenGetRepoNameFromUrl_ShouldReturnTheGitlabNamespacePathForTheGitlabProject(string url) | ||
{ | ||
GitContextReader.GetRepositoryNameFromUrl(url) | ||
.ShouldBe("full-stack/ycs/revenue-management"); | ||
} | ||
} | ||
} |
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