-
Notifications
You must be signed in to change notification settings - Fork 332
Polysemy Spar: Laws for DefaultSsoCode, Now, IdP and ScimExternalIdStore #1940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
c3e1dbe
Now and AssIDStore interpreters
isovector 263f946
Add AReqIDStore.Mem
isovector a6235c5
add boolTTL helper
isovector db1e01f
Add BindCookieStore.Mem
isovector 2072759
Add SAMLUserStore.Mem
isovector b948402
Make format
isovector 96995d0
Add DefaultSsoCode.Mem
isovector 3db57a0
Add ScimExternalIdStore.Mem
isovector c4b51ef
Add ScimTokenStore.Mem
isovector 7f5dbb8
Add ScimUserTimesStore.Mem
isovector c8bd681
make format
isovector 2252951
Changelog
isovector ae3d3ea
Merge branch 'develop' into in-mem-interpreters
isovector b983824
Pull out VerdictFormatStore
isovector 39737af
Remove stale comment
isovector edfa1eb
Also emit internal state
isovector 7b94658
DefaultSsoCodeSpec
isovector be84e41
NowSpec
isovector fb048ae
Add interpreter names
isovector 09954ef
Generalize IdPSpec
isovector 8fd3197
IdPSpec
isovector eef3d07
ScimExternalIdStoreSpec
isovector e2deed3
Better names for ScimExternalIdStoreSpec
isovector ca0f5ed
make format
isovector 4738048
changelog.d
isovector 962f2e8
Fix module name
isovector 1c0808c
Merge branch 'develop' into in-mem-specs
isovector d03760e
Hi CI
isovector 1c2ef7d
More CI
isovector e9ee28c
CI
isovector 10e1515
Merge branch 'develop' into in-mem-specs
isovector 348673e
Update services/spar/test/Test/Spar/Sem/IdPSpec.hs
isovector 2eb6688
Upgrade IdPSpec to 0.9.0.0
isovector d50f114
Merge branch 'in-mem-specs' of github.com:wireapp/wire-server into in…
isovector 8f03a63
Fix a bug from merge
isovector 278a1b9
Update IdPRawMetadataStoreSpec
isovector c2d3e23
Fixed DefaultSsoCodeSpec
isovector 79b43c1
Add a prelude to delete/delete
isovector ca156e7
Fix NowSpec
isovector 097b0aa
Fix ScimExternalIdStoreSpec
isovector 3d21824
Merge branch 'develop' into in-mem-specs
isovector 0b5190c
make format
isovector ee531ae
OCI
isovector File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added laws for DefaultSsoCode, Now, IdP and ScimExternalIdStore | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| {-# LANGUAGE QuantifiedConstraints #-} | ||
| {-# OPTIONS_GHC -Wno-orphans #-} | ||
| {-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} | ||
|
|
||
| module Test.Spar.Sem.DefaultSsoCodeSpec where | ||
|
|
||
| import Arbitrary () | ||
| import Imports | ||
| import Polysemy | ||
| import Polysemy.Check | ||
| import SAML2.WebSSO.Types | ||
| import qualified Spar.Sem.DefaultSsoCode as E | ||
| import Spar.Sem.DefaultSsoCode.Mem | ||
| import Test.Hspec | ||
| import Test.Hspec.QuickCheck | ||
| import Test.QuickCheck | ||
|
|
||
| deriveGenericK ''E.DefaultSsoCode | ||
|
|
||
| propsForInterpreter :: | ||
| PropConstraints r f => | ||
| String -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Spec | ||
| propsForInterpreter interpreter lower = do | ||
| describe interpreter $ do | ||
| prop "delete/delete" $ prop_deleteDelete Nothing lower | ||
| prop "delete/get" $ prop_deleteGet Nothing lower | ||
| prop "delete/store" $ prop_deleteStore Nothing lower | ||
| prop "get/store" $ prop_getStore Nothing lower | ||
| prop "store/delete" $ prop_storeStore Nothing lower | ||
| prop "store/get" $ prop_storeGet Nothing lower | ||
| prop "store/store" $ prop_storeStore Nothing lower | ||
|
|
||
| spec :: Spec | ||
| spec = modifyMaxSuccess (const 1000) $ do | ||
| propsForInterpreter "defaultSsoCodeToMem" $ pure . run . defaultSsoCodeToMem | ||
|
|
||
| -- | All the constraints we need to generalize properties in this module. | ||
| -- A regular type synonym doesn't work due to dreaded impredicative | ||
| -- polymorphism. | ||
| class | ||
| (Functor f, Member E.DefaultSsoCode r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => | ||
| PropConstraints r f | ||
|
|
||
| instance | ||
| (Functor f, Member E.DefaultSsoCode r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => | ||
| PropConstraints r f | ||
|
|
||
| prop_storeGet :: | ||
| PropConstraints r f => | ||
| Maybe (f (Maybe IdPId) -> String) -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Property | ||
| prop_storeGet = | ||
| prepropLaw @'[E.DefaultSsoCode] $ do | ||
| s <- arbitrary | ||
| pure $ | ||
| simpleLaw | ||
| ( do | ||
| E.store s | ||
| E.get | ||
| ) | ||
| ( do | ||
| E.store s | ||
| pure (Just s) | ||
| ) | ||
|
|
||
| prop_getStore :: | ||
| PropConstraints r f => | ||
| Maybe (f () -> String) -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Property | ||
| prop_getStore = | ||
| prepropLaw @'[E.DefaultSsoCode] $ do | ||
| pure $ | ||
| simpleLaw | ||
| ( do | ||
| E.get >>= maybe (pure ()) E.store | ||
| ) | ||
| ( do | ||
| pure () | ||
| ) | ||
|
|
||
| prop_storeDelete :: | ||
| PropConstraints r f => | ||
| Maybe (f () -> String) -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Property | ||
| prop_storeDelete = | ||
| prepropLaw @'[E.DefaultSsoCode] $ do | ||
| s <- arbitrary | ||
| pure $ | ||
| simpleLaw | ||
| ( do | ||
| E.store s | ||
| E.delete | ||
| ) | ||
| ( do | ||
| E.delete | ||
| ) | ||
|
|
||
| prop_deleteStore :: | ||
| PropConstraints r f => | ||
| Maybe (f () -> String) -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Property | ||
| prop_deleteStore = | ||
| prepropLaw @'[E.DefaultSsoCode] $ do | ||
| s <- arbitrary | ||
| pure $ | ||
| simpleLaw | ||
| ( do | ||
| E.delete | ||
| E.store s | ||
| ) | ||
| ( do | ||
| E.store s | ||
| ) | ||
|
|
||
| prop_storeStore :: | ||
| PropConstraints r f => | ||
| Maybe (f () -> String) -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Property | ||
| prop_storeStore = | ||
| prepropLaw @'[E.DefaultSsoCode] $ do | ||
| s <- arbitrary | ||
| s' <- arbitrary | ||
| pure $ | ||
| simpleLaw | ||
| ( do | ||
| E.store s | ||
| E.store s' | ||
| ) | ||
| ( do | ||
| E.store s' | ||
| ) | ||
|
|
||
| prop_deleteDelete :: | ||
| PropConstraints r f => | ||
| Maybe (f () -> String) -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Property | ||
| prop_deleteDelete = | ||
| prepropLaw @'[E.DefaultSsoCode] $ do | ||
| pure $ | ||
| simpleLaw | ||
| ( do | ||
| E.delete | ||
| E.delete | ||
| ) | ||
| ( do | ||
| E.delete | ||
| ) | ||
|
|
||
| prop_deleteGet :: | ||
| PropConstraints r f => | ||
| Maybe (f (Maybe IdPId) -> String) -> | ||
| (forall a. Sem r a -> IO (f a)) -> | ||
| Property | ||
| prop_deleteGet = | ||
| prepropLaw @'[E.DefaultSsoCode] $ do | ||
| pure $ | ||
| simpleLaw | ||
| ( do | ||
| E.delete | ||
| E.get | ||
| ) | ||
| ( do | ||
| E.delete | ||
| pure Nothing | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be a bit confusing for the casual reader of the release notes. i'll fix it on develop after merging.