Lesspass.tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Import-module $PSScriptRoot/Lesspass.psd1 -Force

Describe 'Get-LessPass' {
    Context "Simple rule" {
        It 'Run' {
            Get-LessPass "site" "login" "masterpassword" | Should -BeExactly 'cp$=}`taN2LZ=PF@'
        }

        It 'Expects Length in [5-35]' {
            {Get-LessPass "site" "login" "masterpassword" -Length 2} `
            | Should -Throw "Cannot validate argument on parameter 'Length'. The 2 argument is less than the minimum allowed range"
        }

        It 'Prompt for MasterPassword when missing' {
            (Get-Command Get-LessPass).Parameters['MasterPassword'].Attributes.Mandatory | Should -Be $true
        }
    }
}