Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit b7dccac

Browse files
committed
tests
1 parent 1b2baca commit b7dccac

File tree

10 files changed

+1
-163
lines changed

10 files changed

+1
-163
lines changed

src/Backend/Jp.Domain/CommandHandlers/ApiResourceCommandHandler.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ public async Task<bool> Handle(RegisterApiResourceCommand request, CancellationT
6565
return false;
6666
}
6767

68-
<<<<<<< HEAD
69-
=======
70-
71-
>>>>>>> remotes/origin/master
7268
public async Task<bool> Handle(UpdateApiResourceCommand request, CancellationToken cancellationToken)
7369
{
7470
if (!request.IsValid())

src/Backend/Jp.Domain/Validations/Client/ClientValidations.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ protected void ValidateGrantType()
2020

2121
private bool ValidateGrantCombination(ICollection<string> grantTypes, string message)
2222
{
23-
<<<<<<< HEAD
24-
25-
=======
26-
27-
>>>>>>> remotes/origin/master
2823

2924
// would allow response_type downgrade attack from code to token
3025
if (DisallowGrantTypeCombination(GrantType.Implicit, GrantType.AuthorizationCode, grantTypes))
@@ -68,7 +63,6 @@ protected void ValidateClientName()
6863
RuleFor(c => c.Client.ClientName).NotEmpty().WithMessage("Client Name must be set");
6964
}
7065

71-
<<<<<<< HEAD
7266
protected void ValidateIdentityTokenLifetime()
7367
{
7468
RuleFor(c => c.Client.IdentityTokenLifetime).GreaterThan(0).WithMessage("Identity Token Lifetime must be greatter than 0");
@@ -95,7 +89,5 @@ protected void ValidateDeviceCodeLifetime()
9589
{
9690
RuleFor(c => c.Client.DeviceCodeLifetime).GreaterThan(0).WithMessage("Device Code Lifetime must be greatter than 0");
9791
}
98-
=======
99-
>>>>>>> remotes/origin/master
10092
}
10193
}

src/Backend/Jp.Domain/Validations/Client/UpdateClientCommandValidation.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ public UpdateClientCommandValidation()
88
{
99
ValidateGrantType();
1010
ValidateOldClientId();
11-
<<<<<<< HEAD
1211
ValidateIdentityTokenLifetime();
1312
ValidateAccessTokenLifetime();
1413
ValidateAuthorizationCodeLifetime();
1514
ValidateSlidingRefreshTokenLifetime();
1615
ValidateDeviceCodeLifetime();
1716
ValidateAbsoluteRefreshTokenLifetime();
18-
=======
19-
>>>>>>> remotes/origin/master
2017
}
2118
}
2219
}

src/Backend/Jp.UserManagement/appsettings.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
// Sql Server connection
66
// "SSOConnection": "Server=.;Initial Catalog=JpProject;Persist Security Info=False;User ID=sa;Password=@Password1;MultipleActiveResultSets=False;Connection Timeout=30;"
77
// MySql connection
8-
<<<<<<< HEAD
98
"SSOConnection": "server=jpdatabase,port=3306;database=jpproject;user=jp;password=10203040"
10-
=======
11-
"SSOConnection": "Data Source=tcp:capturadb.database.windows.net,1433;Initial Catalog=jpproject;User [email protected];Password=8BIaspVxw1vOgSIDKdIn"
12-
>>>>>>> remotes/origin/master
139

1410
},
1511
"Logging": {

src/Frontend/Jp.AdminUI/src/app/shared/layout/header/header.component.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ import { UserblockService } from "../sidebar/userblock/userblock.service";
77
import { SettingsService } from "@core/settings/settings.service";
88
import { MenuService } from "@core/menu/menu.service";
99
import { Router } from "@angular/router";
10-
<<<<<<< HEAD
1110
import { environment } from "@env/environment";
12-
=======
13-
import { environment } from "@env/environment.prod";
14-
>>>>>>> remotes/origin/master
15-
1611

1712
@Component({
1813
selector: "app-header",

src/Frontend/Jp.UI.SSO/appsettings.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
// Sql Server connection
66
// "SSOConnection": "Server=.;Initial Catalog=JpProject;Persist Security Info=False;User ID=sa;Password=@Password1;MultipleActiveResultSets=False;Connection Timeout=30;"
77
// MySql connection
8-
<<<<<<< HEAD
98
"SSOConnection": "server=jpdatabase,port=3306;database=jpproject;user=jp;password=10203040"
10-
=======
11-
"SSOConnection": "Data Source=tcp:capturadb.database.windows.net,1433;Initial Catalog=jpproject;User [email protected];Password=8BIaspVxw1vOgSIDKdIn"
12-
>>>>>>> remotes/origin/master
139
},
1410
"CertificateOptions": {
1511
"Type": "Temporary",

tests/JpProject.Domain.Tests/ClientTests/ClientCommandHandlerTests.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
<<<<<<< HEAD
21
using Bogus;
32
using IdentityServer4.EntityFramework.Entities;
43
using IdentityServer4.Models;
5-
=======
6-
using IdentityServer4.Models;
7-
>>>>>>> remotes/origin/master
84
using Jp.Domain.CommandHandlers;
95
using Jp.Domain.Core.Bus;
106
using Jp.Domain.Core.Notifications;
@@ -23,7 +19,6 @@ namespace JpProject.Domain.Tests.ClientTests
2319
{
2420
public class ClientCommandHandlerTests
2521
{
26-
<<<<<<< HEAD
2722
private readonly ClientCommandHandler _commandHandler;
2823
private readonly Mock<DomainNotificationHandler> _notifications;
2924
private readonly Mock<IMediatorHandler> _mediator;
@@ -38,20 +33,6 @@ public class ClientCommandHandlerTests
3833
public ClientCommandHandlerTests()
3934
{
4035
_faker = new Faker();
41-
=======
42-
private ClientCommandHandler _commandHandler;
43-
private Mock<DomainNotificationHandler> _notifications;
44-
private Mock<IMediatorHandler> _mediator;
45-
private Mock<IUnitOfWork> _uow;
46-
private Mock<IClientRepository> _clientRepository;
47-
private Mock<IClientClaimRepository> _clientClaimRepository;
48-
private Mock<IClientPropertyRepository> _clientPropertyRepository;
49-
private Mock<IClientSecretRepository> _clientSecretRepository;
50-
private CancellationTokenSource _tokenSource;
51-
52-
public ClientCommandHandlerTests()
53-
{
54-
>>>>>>> remotes/origin/master
5536
_tokenSource = new CancellationTokenSource();
5637
_uow = new Mock<IUnitOfWork>();
5738
_mediator = new Mock<IMediatorHandler>();
@@ -75,10 +56,7 @@ public async Task ShouldNotAddDuplicatedClientId()
7556
var result = await _commandHandler.Handle(command, _tokenSource.Token);
7657

7758
Assert.False(result);
78-
<<<<<<< HEAD
7959
_uow.Verify(v => v.Commit(), Times.Never);
80-
=======
81-
>>>>>>> remotes/origin/master
8260
}
8361

8462
[Fact]
@@ -135,7 +113,6 @@ public void ShouldNotAllowCombinationOfGrants(string a, string b)
135113
Assert.Throws<InvalidOperationException>(() => command.Client.AllowedGrantTypes = new List<string>() { a, b });
136114
}
137115

138-
<<<<<<< HEAD
139116
[Fact]
140117
public async Task ShouldNotAcceptNegativeAbsoluteRefreshTokenLifetime()
141118
{
@@ -451,8 +428,5 @@ public async Task ShouldSaveClaim()
451428
Assert.False(result);
452429
}
453430

454-
=======
455-
>>>>>>> remotes/origin/master
456-
457431
}
458432
}

tests/JpProject.Domain.Tests/ClientTests/Fakers/ClientCommandFaker.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public static Faker<CopyClientCommand> GenerateCopyClientCommand()
2626

2727
}
2828

29-
<<<<<<< HEAD
3029
public static Faker<UpdateClientCommand> GenerateUpdateClientCommand(
3130
int? absoluteRefreshTokenLifetime = null,
3231
int? identityTokenLifetime = null,
@@ -43,18 +42,10 @@ public static Faker<UpdateClientCommand> GenerateUpdateClientCommand(
4342
authorizationCodeLifetime,
4443
slidingRefreshTokenLifetime,
4544
deviceCodeLifetime).Generate(),
46-
=======
47-
public static Faker<UpdateClientCommand> GenerateUpdateClientCommand()
48-
{
49-
return new Faker<UpdateClientCommand>().CustomInstantiator(f =>
50-
new UpdateClientCommand(
51-
ClientFaker.GenerateClient().Generate(),
52-
>>>>>>> remotes/origin/master
5345
f.Company.CompanyName()
5446
));
5547

5648
}
57-
<<<<<<< HEAD
5849

5950
public static Faker<RemoveClientCommand> GenerateRemoveClientCommand()
6051
{
@@ -111,7 +102,5 @@ public static Faker<SaveClientClaimCommand> GenerateSaveClaimCommand()
111102
));
112103
}
113104

114-
=======
115-
>>>>>>> remotes/origin/master
116105
}
117106
}

tests/JpProject.Domain.Tests/ClientTests/Fakers/ClientFaker.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ namespace JpProject.Domain.Tests.ClientTests.Fakers
77
{
88
public static class ClientFaker
99
{
10-
<<<<<<< HEAD
1110
public static Faker<Client> GenerateClient(
1211
int? absoluteRefreshTokenLifetime = null,
1312
int? identityTokenLifetime = null,
1413
int? accessTokenLifetime = null,
1514
int? authorizationCodeLifetime = null,
1615
int? slidingRefreshTokenLifetime = null,
1716
int? deviceCodeLifetime = null)
18-
=======
19-
public static Faker<Client> GenerateClient()
20-
>>>>>>> remotes/origin/master
2117
{
2218
return new Faker<Client>()
2319
.RuleFor(c => c.Enabled, f => f.Random.Bool())
@@ -44,14 +40,6 @@ public static Faker<Client> GenerateClient()
4440
.RuleFor(c => c.AllowOfflineAccess, f => f.Random.Bool())
4541
.RuleFor(c => c.AllowedScopes, f => f.PickRandom(IdentityHelpers.Scopes, f.Random.Int(1, 5)).ToList())
4642
.RuleFor(c => c.AlwaysIncludeUserClaimsInIdToken, f => f.Random.Bool())
47-
<<<<<<< HEAD
48-
=======
49-
.RuleFor(c => c.IdentityTokenLifetime, f => f.Random.Int())
50-
.RuleFor(c => c.AccessTokenLifetime, f => f.Random.Int())
51-
.RuleFor(c => c.AuthorizationCodeLifetime, f => f.Random.Int())
52-
.RuleFor(c => c.AbsoluteRefreshTokenLifetime, f => f.Random.Int())
53-
.RuleFor(c => c.SlidingRefreshTokenLifetime, f => f.Random.Int())
54-
>>>>>>> remotes/origin/master
5543
.RuleFor(c => c.UpdateAccessTokenClaimsOnRefresh, f => f.Random.Bool())
5644
.RuleFor(c => c.AccessTokenType, f => f.PickRandom<AccessTokenType>())
5745
.RuleFor(c => c.EnableLocalLogin, f => f.Random.Bool())
@@ -62,19 +50,13 @@ public static Faker<Client> GenerateClient()
6250
.RuleFor(c => c.ClientClaimsPrefix, f => f.Lorem.Word())
6351
.RuleFor(c => c.PairWiseSubjectSalt, f => f.Lorem.Word())
6452
.RuleFor(c => c.UserCodeType, f => f.Lorem.Word())
65-
<<<<<<< HEAD
6653
.RuleFor(c => c.AllowedCorsOrigins, f => Enumerable.Range(1, f.Random.Int(1, 3)).Select(x => f.PickRandom(f.Internet.Url())).ToList())
67-
6854
.RuleFor(c => c.IdentityTokenLifetime, f => identityTokenLifetime ?? f.Random.Int(0))
6955
.RuleFor(c => c.AccessTokenLifetime, f => accessTokenLifetime ?? f.Random.Int(0))
7056
.RuleFor(c => c.AuthorizationCodeLifetime, f => authorizationCodeLifetime ?? f.Random.Int(0))
7157
.RuleFor(c => c.AbsoluteRefreshTokenLifetime, f => absoluteRefreshTokenLifetime ?? f.Random.Int(0))
7258
.RuleFor(c => c.SlidingRefreshTokenLifetime, f => slidingRefreshTokenLifetime?? f.Random.Int(0))
7359
.RuleFor(c => c.DeviceCodeLifetime, f => deviceCodeLifetime ?? f.Random.Int(0));
74-
=======
75-
.RuleFor(c => c.DeviceCodeLifetime, f => f.Random.Int())
76-
.RuleFor(c => c.AllowedCorsOrigins, f => Enumerable.Range(1, f.Random.Int(1, 3)).Select(x => f.PickRandom(f.Internet.Url())).ToList());
77-
>>>>>>> remotes/origin/master
7860
}
7961

8062
public static Faker<Secret> GenerateClientSecret()
@@ -86,21 +68,12 @@ public static Faker<Secret> GenerateClientSecret()
8668
}
8769

8870
public static Faker<Claim> GenerateClientClaim()
89-
<<<<<<< HEAD
90-
=======
91-
92-
>>>>>>> remotes/origin/master
9371
{
9472
return new Faker<Claim>().CustomInstantiator(f =>
9573
new Claim(
9674
f.PickRandom(IdentityHelpers.Claims),
9775
f.Lorem.Word()
9876
));
99-
<<<<<<< HEAD
100-
=======
101-
102-
103-
>>>>>>> remotes/origin/master
10477
}
10578
}
10679
}

0 commit comments

Comments
 (0)