Skip to content

Commit

Permalink
Merge pull request #496 from bcgov/ricander
Browse files Browse the repository at this point in the history
Additional Acceptance Criteria validations for Manage Access and MInor refactoring
  • Loading branch information
ychung-mot authored Jul 29, 2024
2 parents 5e72d7b + 4955c58 commit c5f999c
Show file tree
Hide file tree
Showing 37 changed files with 1,198 additions and 277 deletions.
7 changes: 7 additions & 0 deletions Test/UITest/Configuration/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class AppSettings
private IConfigurationSection _UsersSection;
private IConfigurationSection _ServersSection;
private IConfiguration _ConnectionStringSection;
private IConfiguration _ListingFilesSection;

public AppSettings()
{
Expand All @@ -18,6 +19,7 @@ public AppSettings()
_UsersSection = _Configuration.GetSection("Users");
_ServersSection = _Configuration.GetSection("Servers");
_ConnectionStringSection = _Configuration.GetSection("ConnectionStrings");
_ListingFilesSection = _Configuration.GetSection("ListingFiles");
}

public string GetUser(string Key)
Expand All @@ -33,6 +35,11 @@ public string GetConnectionString(string key)
{
return (_ConnectionStringSection[key]);
}

public string GetListingFile(string key)
{
return (_ListingFilesSection[key]);
}
}
}

4 changes: 0 additions & 4 deletions Test/UITest/DataBase/Entities/DssDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public DssDbContext(DbContextOptions<DssDbContext> options)

public virtual DbSet<DssUserRole> DssUserRoles { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseNpgsql("Host=localhost;Database=strdssdev;Username=strdssdev;Password=test@123");

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasPostgresExtension("postgis");
Expand Down
23 changes: 23 additions & 0 deletions Test/UITest/DataBase/Entities/DssDbContextPartial.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataBase.Entities
{
public partial class DssDbContext : DbContext
{
private string _ConnectionString = string.Empty;

public DssDbContext(DbContextOptions<DssDbContext> options, string ConnectionString) : base(options)
{
_ConnectionString = ConnectionString;
}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseNpgsql(_ConnectionString);

}
}
11 changes: 3 additions & 8 deletions Test/UITest/DataBase/Repositories/GenericRespository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,8 @@ public virtual TEntity GetByID(object id)
return (result);
}

///TODO: Implement GetByName()
//public virtual TEntity GetByName(TEntity entity, string Name)
//{
//}

public virtual TEntity Insert(TEntity entity)
{
var foo = _DbSet.Add(entity);
return (_DbSet.Add(entity).Entity);
}

Expand All @@ -114,8 +108,9 @@ public virtual void Delete(object id)

public virtual void Delete(TEntity entityToDelete)
{
if (_Context.Entry(entityToDelete).State == EntityState.Detached)
_DbSet.Attach(entityToDelete);
//Don't change state, just load entity
//if (_Context.Entry(entityToDelete).State == EntityState.Detached)
// _DbSet.Attach(entityToDelete);

_DbSet.Remove(entityToDelete);
}
Expand Down
2 changes: 2 additions & 0 deletions Test/UITest/DataBase/UnitOfWork/IUnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public interface IUnitOfWork
GenericRepository<DssUserIdentityView> DssUserIdentityViewRepository { get; }
GenericRepository<DssUserPrivilege> DssUserPrivilegeRepository { get; }
GenericRepository<DssUserRole> DssUserRoleRepository { get; }
GenericRepository<DssUploadDelivery> DssUploadDeliveryRepository { get; }
GenericRepository<DssUploadLine> DssUploadLineRepository { get; }

void Dispose();
void Save();
Expand Down
27 changes: 14 additions & 13 deletions Test/UITest/DataBase/UnitOfWork/UnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,7 @@ public class UnitOfWork : IDisposable, IUnitOfWork
DbContext _context;
bool _disposed;

//public GenericRepository<DssAccessRequestStatus> DssAccessRequestStatus { get; }
//public GenericRepository<DssDbContext> DssDbContext { get; }
//public GenericRepository<DssEmailMessage> DssEmailMessage { get; }
//public GenericRepository<DssEmailMessageType> DssEmailMessageType { get; }
//public GenericRepository<DssMessageReason> DssMessageReason { get; }
//public GenericRepository<DssOrganization> DssOrganization { get; }
//public GenericRepository<DssOrganizationContactPerson> DssOrganizationContactPerson { get; }
//public GenericRepository<DssOrganizationType> DssOrganizationType { get; }
//public GenericRepository<DssUserIdentity> DssUserIdentity { get; }
//public GenericRepository<DssUserIdentityView> DssUserIdentityView { get; }
//public GenericRepository<DssUserPrivilege> DssUserPrivilege { get; }
//GenericRepository<DssUserRole> DssUserRole { get; }


private readonly GenericRepository<DssAccessRequestStatus> _DssAccessRequestStatusRepository;
private readonly GenericRepository<DssEmailMessage> _DssEmailMessageRepository;
Expand All @@ -37,7 +26,8 @@ public class UnitOfWork : IDisposable, IUnitOfWork
private readonly GenericRepository<DssUserIdentity> _DssUserIdentityRepository;
private readonly GenericRepository<DssUserIdentityView> _DssUserIdentityViewRepository;
private readonly GenericRepository<DssUserPrivilege> _DssUserPrivilegeRepository;
//private readonly GenericRepository<DssMessageReason> _DssMessageReasonRepository;
private readonly GenericRepository<DssUploadDelivery> _DssUploadDeliveryRepository;
private readonly GenericRepository<DssUploadLine> _DssUploadLineRepository;
private readonly GenericRepository<DssUserRole> _DssUserRoleRepository;


Expand Down Expand Up @@ -88,6 +78,17 @@ public GenericRepository<DssUserIdentityView> DssUserIdentityViewRepository
{
get => _DssUserIdentityViewRepository ?? new GenericRepository<DssUserIdentityView>(_context);
}

public GenericRepository<DssUploadDelivery> DssUploadDeliveryRepository
{
get => _DssUploadDeliveryRepository ?? new GenericRepository<DssUploadDelivery>(_context);
}

public GenericRepository<DssUploadLine> DssUploadLineRepository
{
get => _DssUploadLineRepository ?? new GenericRepository<DssUploadLine>(_context);
}

public GenericRepository<DssUserRole> DssUserRoleRepository
{
get => _DssUserRoleRepository ?? new GenericRepository<DssUserRole>(_context);
Expand Down
119 changes: 0 additions & 119 deletions Test/UITest/DataBase/UnitOfWork/UserIdentityUnitOfWork.cs

This file was deleted.

6 changes: 6 additions & 0 deletions Test/UITest/MOHShortTermRentalTest.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigurationUnitTests", "C
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataBase", "DataBase\DataBase.csproj", "{47E59E4B-9824-4E49-B1A6-C956402679A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsAutomation", "WinFormsLibrary1\WindowsAutomation.csproj", "{213BAB38-0602-4072-BA0A-8F3F3B85CF08}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -39,6 +41,10 @@ Global
{47E59E4B-9824-4E49-B1A6-C956402679A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47E59E4B-9824-4E49-B1A6-C956402679A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47E59E4B-9824-4E49-B1A6-C956402679A8}.Release|Any CPU.Build.0 = Release|Any CPU
{213BAB38-0602-4072-BA0A-8F3F3B85CF08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{213BAB38-0602-4072-BA0A-8F3F3B85CF08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{213BAB38-0602-4072-BA0A-8F3F3B85CF08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{213BAB38-0602-4072-BA0A-8F3F3B85CF08}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
Feature: DenyAccessToSystem
Link to a feature: https://hous-hpb.atlassian.net/browse/DSS-75

@Access
@Access @Headless
Scenario: DenyAccessToSystem
#User Authentication

Given that I am an authenticated LG, CEU, Provincial Gov or Platform user and the expected result is "<ExpectedResult>"

When I attempt to access the Data Sharing System as "<UserName>"
#When I attempt to access the Data Sharing System as "<UserName>" with email "<Email>" and Role "<RoleName>"
When I attempt to access the Data Sharing System as "<UserName>" with email "<Email>" and Role "<RoleName>"

Then I dont have the required access permissions

Then I should see a specific message indicating that access is restricted
#
#
Examples:
| UserName | Description | ExpectedResult |
| CEUATST | HappyPath | pass |
| UserName | Email | RoleName | Description | ExpectedResult |
| CEUATST | ceuatst@gov.bc.ca | ceu_admin | HappyPath | pass |

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ Scenario: ManagingAccess

#Request Details:

When Reviewing a specific access request
When Reviewing a specific access request

Then I should be able to view detailed information provided by the user, including their role request and any justifications or additional comments

#Grant Access Button:

When Reviewing an access request

Then There should be a Grant Access button allowing me to approve the user's request
Then There should be a Grant Access button allowing me to approve the user's request "<RequestingAccessUser>"


#Role Assignment:

Expand Down Expand Up @@ -62,8 +63,8 @@ Scenario: ManagingAccess
#
#
Examples:
| UserName | ListingID | Description | ExpectedResult | ListingURL | AdditionalCCsTextBox | GovPhoneNumber | TakedownReason |
| CEUATST | 0 | ListingID - Boundary | pass | http://listingURL.com | richard.anderson@dxc.com | 9991231234 | Get a business license |
| UserName | ListingID | Description | ExpectedResult | ListingURL | RequestingAccessUser |AdditionalCCsTextBox | GovPhoneNumber | TakedownReason |
| CEUATST | 0 | ListingID - Boundary | pass | http://listingURL.com | STRDSSVrboDev |richard.anderson@dxc.com | 9991231234 | Get a business license |



Loading

0 comments on commit c5f999c

Please sign in to comment.