PasswordState-Management icon indicating copy to clipboard operation
PasswordState-Management copied to clipboard

Create Tests for New-PasswordStateList function

Open trir262 opened this issue 5 years ago • 2 comments

I'd like to create unit tests for the New-PasswordStateList function similar to what I've created before. Unfortunately my account in our company is not allowed to create passwordlists. Can you provide me an example request/response json file I can use to create the tests? Thanks!

trir262 avatar May 02 '20 21:05 trir262

@trir262 you can use my test instance, it's only got dummy data anyway. https://devpws01.northeurope.cloudapp.azure.com/logins/forms/login.aspx?

I'll send you the credentials in an email.

dnewsholme avatar May 03 '20 10:05 dnewsholme

@trir262

Here is a json request that you could use for the test environment.

Just change the SecurityGroupName to a valid name in the testing environment. You could also use a SecurityGroupID or a UserID (domain\Name). Perhaps @dnewsholme can provide a existing group name/id/userid.

TemplateID 1 should exist in every environment (i hope so).

Example:

new-passwordstatelist -Name "PublicTestList" -Description "Public List for testing" `
-Guide "Test Guide" -ImageFileName "authentication.png" `
-LinkToTemplate 1 -CopySettingsFromTemplateID 1 `
-Permission "A" -ApplyPermissionsForSecurityGroupName "<GROUP NAME>"

Request:

{
  "PasswordList": "PublicTestList",
  "Description": "Public List for testing",
  "CopySettingsFromPasswordListID": "",
  "CopySettingsFromTemplateID": "1",
  "CopyPermissionsFromPasswordListID": "",
  "CopyPermissionsFromTemplateID": "",
  "NestUnderFolderID": 0,
  "LinkToTemplate": "1",
  "SiteID": 0,
  "ApplyPermissionsForUserID": "",
  "ApplyPermissionsForSecurityGroupID": "",
  "ApplyPermissionsForSecurityGroupName": "<GROUP NAME>",
  "ImageFileName": "authentication.png",
  "PasswordGeneratorID": 0,
  "PasswordStrengthPolicyID": 1,
  "PreventBadPasswordUse": false,
  "AllowExport": false,
  "PasswordResetEnabled": false,
  "PrivatePasswordList": false,
  "Permission": "A",
  "Guide": "Test Guide"
}

Response:

PasswordListID                : 255
PasswordList                  : PublicTestList
Description                   : Public List for testing
ImageFileName                 : authentication.png
Guide                         : Test Guide
AllowExport                   : False
PrivatePasswordList           : False
TimeBasedAccessRequired       : False
NoApprovers                   : 1
DisableNotifications          : False
PasswordStrengthPolicyID      : 1
PasswordGeneratorID           : 1
CodePage                      : Using Passwordstate Default Code Page
PreventPasswordReuse          : 5
AuthenticationType            : None Required
AuthenticationPerSession      : False
PreventExpiryDateModification : False
SetExpiryDate                 : 0
ResetExpiryDate               : 0
PreventDragDrop               : True
PreventBadPasswordUse         : True
ProvideAccessReason           : False
TreePath                      : \
TotalPasswords                : 0
GeneratorName                 : Default Password Generator
PolicyName                    : Default Policy
PasswordResetEnabled          : False
ForcePasswordGenerator        : False
HidePasswords                 : False
ShowGuide                     : False
EnablePasswordResetSchedule   : False
PasswordResetSchedule         : 00:00
AddDaysToExpiryDate           : 90
SiteID                        : 0
SiteLocation                  : Internal
OneTimePasswords              : False

eizedev avatar May 03 '20 12:05 eizedev