removed applyPWPolicy

This commit is contained in:
Jonathan Lamothe
2018-12-17 14:30:32 -05:00
parent 14e367bd43
commit 2b9bedced5
3 changed files with 1 additions and 73 deletions

View File

@@ -26,7 +26,6 @@ import Control.Monad (when)
import System.Exit (exitFailure)
import Test.HUnit (errors, failures, runTestTT, Test(TestList))
import qualified Spec.ApplyPWPolicy as ApplyPWPolicy
import qualified Spec.PWPolicy as PWPolicy
import qualified Spec.ValidatePWPolicy as ValidatePWPolicy
@@ -38,7 +37,6 @@ main = do
tests = TestList
[ PWPolicy.tests
, ValidatePWPolicy.tests
, ApplyPWPolicy.tests
]
--jl

View File

@@ -1,52 +0,0 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
<https://www.gnu.org/licenses/>.
-}
module Spec.ApplyPWPolicy (tests) where
import Control.Lens (set)
import Test.HUnit (Test(..), (~?=))
import Password
tests = TestLabel "applyPWPolicy" $ TestList $ map test'
[ ( "default pass", "password", id, True )
, ( "too long", replicate 99 'x', id, False )
, ( "insufficient upper", "password", set pwUpper 1, False )
, ( "sufficient upper", "Password", set pwUpper 1, True )
, ( "insufficient lower", "PASSWORD", set pwLower 1, False )
, ( "sufficient lower", "password", set pwLower 1, True )
, ( "insufficient digits", "password", set pwDigits 1, False )
, ( "sufficient digits", "password1", set pwDigits 1, True )
, ( "insufficient special", "Password1", spec (Just 1), False )
, ( "sufficient special", "Password1/", spec (Just 1), True )
, ( "illegal special", "Password1/", spec Nothing, False )
, ( "bad policy", "password", badPolicy, False )
]
test' (label, pw, f, expect) = TestLabel label $
applyPWPolicy pw (f newPWPolicy) ~?= expect
spec = set pwSpecial
badPolicy = set pwUpper (-1)
--jl