Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvazarkar committed Oct 15, 2024
1 parent 6927f71 commit 3ce123d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/unit/ACLProcessorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,13 @@ public async Task ACLProcessor_ProcessGMSAReaders_Null_PrincipalID() {
}

[Fact]
public async Task ACLProcessor_ProcessACL_Null_NTSecurityDescriptor() {
var processor = new ACLProcessor(new MockLdapUtils());
public async Task ACLProcessor_ProcessACL_Null_NTSecurityDescriptor()
{
var mock = new Mock<MockLdapUtils>();
mock.Setup(x => x.PagedQuery(It.IsAny<LdapQueryParameters>(), It.IsAny<CancellationToken>()))
.Returns(AsyncEnumerable.Empty<LdapResult<IDirectoryObject>>());
var processor = new ACLProcessor(mock.Object);

var result = await processor.ProcessACL(null, _testDomainName, Label.User, false).ToArrayAsync();

Assert.Empty(result);
Expand Down Expand Up @@ -261,6 +266,8 @@ public async Task ACLProcessor_ProcessACL_Null_SID() {
.Returns(collection);
mockSecurityDescriptor.Setup(m => m.GetOwner(It.IsAny<Type>())).Returns((string)null);
mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object);
mockLDAPUtils.Setup(x => x.PagedQuery(It.IsAny<LdapQueryParameters>(), It.IsAny<CancellationToken>()))
.Returns(AsyncEnumerable.Empty<LdapResult<IDirectoryObject>>());

var processor = new ACLProcessor(mockLDAPUtils.Object);
var bytes = Utils.B64ToBytes(UnProtectedUserNtSecurityDescriptor);
Expand All @@ -279,6 +286,8 @@ public async Task ACLProcessor_ProcessACL_Null_ACE() {
.Returns(collection);
mockSecurityDescriptor.Setup(m => m.GetOwner(It.IsAny<Type>())).Returns((string)null);
mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object);
mockLDAPUtils.Setup(x => x.PagedQuery(It.IsAny<LdapQueryParameters>(), It.IsAny<CancellationToken>()))
.Returns(AsyncEnumerable.Empty<LdapResult<IDirectoryObject>>());

var processor = new ACLProcessor(mockLDAPUtils.Object);
var bytes = Utils.B64ToBytes(UnProtectedUserNtSecurityDescriptor);
Expand All @@ -300,6 +309,8 @@ public async Task ACLProcessor_ProcessACL_Deny_ACE() {
.Returns(collection);
mockSecurityDescriptor.Setup(m => m.GetOwner(It.IsAny<Type>())).Returns((string)null);
mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object);
mockLDAPUtils.Setup(x => x.PagedQuery(It.IsAny<LdapQueryParameters>(), It.IsAny<CancellationToken>()))
.Returns(AsyncEnumerable.Empty<LdapResult<IDirectoryObject>>());

var processor = new ACLProcessor(mockLDAPUtils.Object);
var bytes = Utils.B64ToBytes(UnProtectedUserNtSecurityDescriptor);
Expand All @@ -322,6 +333,8 @@ public async Task ACLProcessor_ProcessACL_Unmatched_Inheritance_ACE() {
.Returns(collection);
mockSecurityDescriptor.Setup(m => m.GetOwner(It.IsAny<Type>())).Returns((string)null);
mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object);
mockLDAPUtils.Setup(x => x.PagedQuery(It.IsAny<LdapQueryParameters>(), It.IsAny<CancellationToken>()))
.Returns(AsyncEnumerable.Empty<LdapResult<IDirectoryObject>>());

var processor = new ACLProcessor(mockLDAPUtils.Object);
var bytes = Utils.B64ToBytes(UnProtectedUserNtSecurityDescriptor);
Expand All @@ -345,6 +358,8 @@ public async Task ACLProcessor_ProcessACL_Null_SID_ACE() {
.Returns(collection);
mockSecurityDescriptor.Setup(m => m.GetOwner(It.IsAny<Type>())).Returns((string)null);
mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object);
mockLDAPUtils.Setup(x => x.PagedQuery(It.IsAny<LdapQueryParameters>(), It.IsAny<CancellationToken>()))
.Returns(AsyncEnumerable.Empty<LdapResult<IDirectoryObject>>());

var processor = new ACLProcessor(mockLDAPUtils.Object);
var bytes = Utils.B64ToBytes(UnProtectedUserNtSecurityDescriptor);
Expand Down

0 comments on commit 3ce123d

Please sign in to comment.