module Test.FeatureFlags.Mls where import SetupHelpers import Test.FeatureFlags.Util import Testlib.Prelude testMls :: (HasCallStack) => APIAccess -> App () testMls :: HasCallStack => APIAccess -> App () testMls APIAccess access = do Value user <- Domain -> CreateUser -> App Value forall domain. (HasCallStack, MakesValue domain) => domain -> CreateUser -> App Value randomUser Domain OwnDomain CreateUser forall a. Default a => a def String uid <- App Value -> App String forall a. (HasCallStack, MakesValue a) => a -> App String asString (App Value -> App String) -> App Value -> App String forall a b. (a -> b) -> a -> b $ Value user Value -> String -> App Value forall a. (HasCallStack, MakesValue a) => a -> String -> App Value %. String "id" String -> FeatureTests mkFeatureTests String "mls" FeatureTests -> (FeatureTests -> FeatureTests) -> FeatureTests forall a b. a -> (a -> b) -> b & Value -> FeatureTests -> FeatureTests addUpdate (String -> Value mls1 String uid) FeatureTests -> (FeatureTests -> FeatureTests) -> FeatureTests forall a b. a -> (a -> b) -> b & Value -> FeatureTests -> FeatureTests addUpdate Value mls2 FeatureTests -> (FeatureTests -> FeatureTests) -> FeatureTests forall a b. a -> (a -> b) -> b & Value -> FeatureTests -> FeatureTests addInvalidUpdate Value mlsInvalidConfig FeatureTests -> (FeatureTests -> App ()) -> App () forall a b. a -> (a -> b) -> b & Domain -> APIAccess -> FeatureTests -> App () forall domain. (HasCallStack, MakesValue domain) => domain -> APIAccess -> FeatureTests -> App () runFeatureTests Domain OwnDomain APIAccess access testMlsPatch :: (HasCallStack) => App () testMlsPatch :: HasCallStack => App () testMlsPatch = do Value mlsMigrationDefaultConfig <- Value defAllFeatures Value -> String -> App Value forall a. (HasCallStack, MakesValue a) => a -> String -> App Value %. String "mlsMigration.config" ServiceOverrides -> (HasCallStack => String -> App ()) -> App () forall a. HasCallStack => ServiceOverrides -> (HasCallStack => String -> App a) -> App a withModifiedBackend ServiceOverrides forall a. Default a => a def { galleyCfg = setField "settings.featureFlags.mlsMigration.defaults" ( object [ "lockStatus" .= "locked", "status" .= "disabled", "config" .= mlsMigrationDefaultConfig ] ) } ((HasCallStack => String -> App ()) -> App ()) -> (HasCallStack => String -> App ()) -> App () forall a b. (a -> b) -> a -> b $ \String domain -> do String -> String -> Value -> App () forall domain. (HasCallStack, MakesValue domain) => domain -> String -> Value -> App () checkPatch String domain String "mls" (Value -> App ()) -> Value -> App () forall a b. (a -> b) -> a -> b $ [Pair] -> Value object [String "lockStatus" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "locked"] String -> String -> Value -> App () forall domain. (HasCallStack, MakesValue domain) => domain -> String -> Value -> App () checkPatch String domain String "mls" (Value -> App ()) -> Value -> App () forall a b. (a -> b) -> a -> b $ [Pair] -> Value object [String "status" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "enabled"] String -> String -> Value -> App () forall domain. (HasCallStack, MakesValue domain) => domain -> String -> Value -> App () checkPatch String domain String "mls" (Value -> App ()) -> Value -> App () forall a b. (a -> b) -> a -> b $ [Pair] -> Value object [String "lockStatus" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "locked", String "status" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "enabled"] String -> String -> Value -> App () forall domain. (HasCallStack, MakesValue domain) => domain -> String -> Value -> App () checkPatch String domain String "mls" (Value -> App ()) -> Value -> App () forall a b. (a -> b) -> a -> b $ [Pair] -> Value object [ String "status" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "enabled", String "config" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= [Pair] -> Value object [ String "protocolToggleUsers" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([] :: [String]), String "defaultProtocol" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "mls", String "supportedProtocols" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= [String "proteus", String "mls"], String "allowedCipherSuites" String -> [Int] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([Int 1] :: [Int]), String "defaultCipherSuite" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= Int -> Value forall a. ToJSON a => a -> Value toJSON (Int 1 :: Int) ] ] String -> String -> Value -> App () forall domain. (HasCallStack, MakesValue domain) => domain -> String -> Value -> App () checkPatch String domain String "mls" (Value -> App ()) -> Value -> App () forall a b. (a -> b) -> a -> b $ [Pair] -> Value object [ String "config" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= [Pair] -> Value object [ String "protocolToggleUsers" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([] :: [String]), String "defaultProtocol" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "mls", String "supportedProtocols" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= [String "proteus", String "mls"], String "allowedCipherSuites" String -> [Int] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([Int 1] :: [Int]), String "defaultCipherSuite" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= Int -> Value forall a. ToJSON a => a -> Value toJSON (Int 1 :: Int) ] ] mls1 :: String -> Value mls1 :: String -> Value mls1 String uid = [Pair] -> Value object [ String "status" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "enabled", String "config" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= [Pair] -> Value object [ String "protocolToggleUsers" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= [String uid], String "defaultProtocol" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "mls", String "supportedProtocols" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= [String "proteus", String "mls"], String "allowedCipherSuites" String -> [Int] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([Int 1] :: [Int]), String "defaultCipherSuite" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= Int -> Value forall a. ToJSON a => a -> Value toJSON (Int 1 :: Int) ] ] mls2 :: Value mls2 :: Value mls2 = [Pair] -> Value object [ String "status" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "enabled", String "config" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= [Pair] -> Value object [ String "protocolToggleUsers" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([] :: [String]), String "defaultProtocol" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "mls", String "supportedProtocols" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= [String "mls"], String "allowedCipherSuites" String -> [Int] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([Int 1] :: [Int]), String "defaultCipherSuite" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= Int -> Value forall a. ToJSON a => a -> Value toJSON (Int 1 :: Int) ] ] mlsInvalidConfig :: Value mlsInvalidConfig :: Value mlsInvalidConfig = [Pair] -> Value object [ String "status" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "enabled", String "config" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= [Pair] -> Value object [ String "protocolToggleUsers" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([] :: [String]), String "defaultProtocol" String -> String -> Pair forall a. ToJSON a => String -> a -> Pair .= String "mls", String "supportedProtocols" String -> [String] -> Pair forall a. ToJSON a => String -> a -> Pair .= [String "proteus"], String "allowedCipherSuites" String -> [Int] -> Pair forall a. ToJSON a => String -> a -> Pair .= ([Int 1] :: [Int]), String "defaultCipherSuite" String -> Value -> Pair forall a. ToJSON a => String -> a -> Pair .= Int -> Value forall a. ToJSON a => a -> Value toJSON (Int 1 :: Int) ] ]