From 07e5e1bfdf4f18c909c9a3dc105393aac53063cf Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Tue, 22 Nov 2022 15:52:53 +0000 Subject: [PATCH 1/2] golden tests for events --- .../src/Wire/API/Event/FeatureConfig.hs | 30 ++- .../golden/Test/Wire/API/Golden/Generated.hs | 33 +++- .../Golden/Generated/Event_conversation.hs | 178 ++++++++++++++++++ .../Golden/Generated/Event_featureConfig.hs | 54 ++++++ .../testObject_Event_conversation_1.json | 15 ++ .../testObject_Event_conversation_10.json | 15 ++ .../testObject_Event_conversation_11.json | 17 ++ .../testObject_Event_conversation_2.json | 23 +++ .../testObject_Event_conversation_3.json | 19 ++ .../testObject_Event_conversation_4.json | 22 +++ .../testObject_Event_conversation_5.json | 15 ++ .../testObject_Event_conversation_6.json | 20 ++ .../testObject_Event_conversation_7.json | 19 ++ .../testObject_Event_conversation_8.json | 17 ++ .../testObject_Event_conversation_9.json | 95 ++++++++++ .../testObject_Event_featureConfig_1.json | 12 ++ .../testObject_Event_featureConfig_10.json | 9 + .../testObject_Event_featureConfig_2.json | 9 + .../testObject_Event_featureConfig_3.json | 9 + .../testObject_Event_featureConfig_4.json | 9 + .../testObject_Event_featureConfig_5.json | 9 + .../testObject_Event_featureConfig_6.json | 9 + .../testObject_Event_featureConfig_7.json | 9 + .../testObject_Event_featureConfig_8.json | 12 ++ .../testObject_Event_featureConfig_9.json | 9 + libs/wire-api/wire-api.cabal | 2 + 26 files changed, 668 insertions(+), 2 deletions(-) create mode 100644 libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_conversation.hs create mode 100644 libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_featureConfig.hs create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_1.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_10.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_11.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_2.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_3.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_4.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_5.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_6.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_7.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_8.json create mode 100644 libs/wire-api/test/golden/testObject_Event_conversation_9.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_1.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_10.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_2.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_3.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_4.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_5.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_6.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_7.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_8.json create mode 100644 libs/wire-api/test/golden/testObject_Event_featureConfig_9.json diff --git a/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs b/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs index 967d5bc8641..09f670db6f8 100644 --- a/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs +++ b/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs @@ -30,7 +30,9 @@ import Data.Schema import qualified Data.Swagger as S import GHC.TypeLits (KnownSymbol) import Imports +import Test.QuickCheck.Gen (oneof) import Wire.API.Team.Feature +import Wire.Arbitrary (Arbitrary (..), GenericUniform (..)) data Event = Event { _eventType :: EventType, @@ -40,8 +42,34 @@ data Event = Event deriving (Eq, Show, Generic) deriving (A.ToJSON, A.FromJSON) via Schema Event +instance Arbitrary Event where + arbitrary = + do + let arbConfig = + oneof + [ arbitrary @(WithStatus SSOConfig) <&> toJSON, + arbitrary @(WithStatus SearchVisibilityAvailableConfig) <&> toJSON, + arbitrary @(WithStatus ValidateSAMLEmailsConfig) <&> toJSON, + arbitrary @(WithStatus DigitalSignaturesConfig) <&> toJSON, + arbitrary @(WithStatus AppLockConfig) <&> toJSON, + arbitrary @(WithStatus FileSharingConfig) <&> toJSON, + arbitrary @(WithStatus ClassifiedDomainsConfig) <&> toJSON, + arbitrary @(WithStatus ConferenceCallingConfig) <&> toJSON, + arbitrary @(WithStatus SelfDeletingMessagesConfig) <&> toJSON, + arbitrary @(WithStatus GuestLinksConfig) <&> toJSON, + arbitrary @(WithStatus SndFactorPasswordChallengeConfig) <&> toJSON, + arbitrary @(WithStatus SearchVisibilityInboundConfig) <&> toJSON, + arbitrary @(WithStatus MLSConfig) <&> toJSON, + arbitrary @(WithStatus ExposeInvitationURLsToTeamAdminConfig) <&> toJSON + ] + Event + <$> arbitrary + <*> arbitrary + <*> arbConfig + data EventType = Update - deriving (Eq, Show) + deriving (Eq, Show, Generic) + deriving (Arbitrary) via GenericUniform EventType instance ToSchema EventType where schema = diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs index ccff53d7278..32471911e4a 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs @@ -83,6 +83,8 @@ import qualified Test.Wire.API.Golden.Generated.EmailUpdate_user import qualified Test.Wire.API.Golden.Generated.Email_user import qualified Test.Wire.API.Golden.Generated.EventType_team import qualified Test.Wire.API.Golden.Generated.EventType_user +import qualified Test.Wire.API.Golden.Generated.Event_conversation +import qualified Test.Wire.API.Golden.Generated.Event_featureConfig import qualified Test.Wire.API.Golden.Generated.Event_team import qualified Test.Wire.API.Golden.Generated.Event_user import qualified Test.Wire.API.Golden.Generated.HandleUpdate_user @@ -1389,5 +1391,34 @@ tests = testGroup "Golden: WithStatusPatch_team 19" $ testObjects - [(Test.Wire.API.Golden.Generated.WithStatusPatch_team.testObject_WithStatusPatch_team_19, "testObject_WithStatusPatch_team_19.json")] + [(Test.Wire.API.Golden.Generated.WithStatusPatch_team.testObject_WithStatusPatch_team_19, "testObject_WithStatusPatch_team_19.json")], + testGroup + "Golden: Event_FeatureConfig" + $ testObjects + [ (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_1, "testObject_Event_featureConfig_1.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_2, "testObject_Event_featureConfig_2.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_3, "testObject_Event_featureConfig_3.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_4, "testObject_Event_featureConfig_4.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_5, "testObject_Event_featureConfig_5.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_6, "testObject_Event_featureConfig_6.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_7, "testObject_Event_featureConfig_7.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_8, "testObject_Event_featureConfig_8.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_9, "testObject_Event_featureConfig_9.json"), + (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_10, "testObject_Event_featureConfig_10.json") + ], + testGroup + "Golden: Event_Conversation" + $ testObjects + [ (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_1, "testObject_Event_conversation_1.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_2, "testObject_Event_conversation_2.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_3, "testObject_Event_conversation_3.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_4, "testObject_Event_conversation_4.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_5, "testObject_Event_conversation_5.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_6, "testObject_Event_conversation_6.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_7, "testObject_Event_conversation_7.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_8, "testObject_Event_conversation_8.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_9, "testObject_Event_conversation_9.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_11, "testObject_Event_conversation_11.json"), + (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_10, "testObject_Event_conversation_10.json") + ] ] diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_conversation.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_conversation.hs new file mode 100644 index 00000000000..77422d6a917 --- /dev/null +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_conversation.hs @@ -0,0 +1,178 @@ +{-# LANGUAGE OverloadedLists #-} + +-- This file is part of the Wire Server implementation. +-- +-- Copyright (C) 2022 Wire Swiss GmbH +-- +-- This program is free software: you can redistribute it and/or modify it under +-- the terms of the GNU Affero 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 Affero General Public License for more +-- details. +-- +-- You should have received a copy of the GNU Affero General Public License along +-- with this program. If not, see . + +module Test.Wire.API.Golden.Generated.Event_conversation where + +import Data.Code +import Data.Domain (Domain (..)) +import Data.Id +import Data.Misc (HttpsUrl (HttpsUrl)) +import Data.Qualified (Qualified (..)) +import Data.Range +import Data.Time +import qualified Data.UUID as UUID +import GHC.Exts (IsList (fromList)) +import Imports +import URI.ByteString (Authority (..), Host (..), Query (..), Scheme (..), URIRef (..)) +import Wire.API.Conversation (Access (..), MutedStatus (..)) +import Wire.API.Conversation.Role +import Wire.API.Conversation.Typing +import Wire.API.Event.Conversation + +testObject_Event_conversation_1 :: Event +testObject_Event_conversation_1 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "oym59-06.i423w"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "n8nl6tp.h5"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdConvCodeDelete + } + +testObject_Event_conversation_2 :: Event +testObject_Event_conversation_2 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "2m99----34.id7u09"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "b.0-7.0.rg"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = + EdMemberUpdate + ( MemberUpdateData + { misTarget = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "oy8yz.f1"}}, + misOtrMutedStatus = Just (MutedStatus {fromMutedStatus = 1}), + misOtrMutedRef = Nothing, + misOtrArchived = Nothing, + misOtrArchivedRef = Nothing, + misHidden = Nothing, + misHiddenRef = Nothing, + misConvRoleName = Just roleNameWireAdmin + } + ) + } + +testObject_Event_conversation_3 :: Event +testObject_Event_conversation_3 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "91.ii9vf.mbwj9k7lmk"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "k3.f.z"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = + EdConvCodeUpdate + ( ConversationCode + { conversationKey = Key {asciiKey = unsafeRange "CRdONS7988O2QdyndJs1"}, + conversationCode = Value {asciiValue = unsafeRange "7d6713"}, + conversationUri = Just $ HttpsUrl (URI {uriScheme = Scheme {schemeBS = "https"}, uriAuthority = Just (Authority {authorityUserInfo = Nothing, authorityHost = Host {hostBS = "example.com"}, authorityPort = Nothing}), uriPath = "", uriQuery = Query {queryPairs = []}, uriFragment = Nothing}) + } + ) + } + +testObject_Event_conversation_4 :: Event +testObject_Event_conversation_4 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "ma--6us.i8o--0440"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "97k-u0.b-5c"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdConvAccessUpdate (ConversationAccessData {cupAccess = fromList [PrivateAccess, CodeAccess], cupAccessRoles = fromList []}) + } + +testObject_Event_conversation_5 :: Event +testObject_Event_conversation_5 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "q.6lm833.o95.l.y2"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "7.m4f7p.ez4zs61"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdMLSWelcome "" + } + +testObject_Event_conversation_6 :: Event +testObject_Event_conversation_6 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "391.r"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "8.0-6.t7pxv"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdOtrMessage (OtrMessage {otrSender = ClientId {client = "1"}, otrRecipient = ClientId {client = "1"}, otrCiphertext = "", otrData = Just "I\68655"}) + } + +testObject_Event_conversation_7 :: Event +testObject_Event_conversation_7 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "b2.ue4k"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "64b3--h.u"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdOtrMessage (OtrMessage {otrSender = ClientId {client = "3"}, otrRecipient = ClientId {client = "3"}, otrCiphertext = "%\SI", otrData = Nothing}) + } + +testObject_Event_conversation_8 :: Event +testObject_Event_conversation_8 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "36.e9.s-o-17"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "0--gy.705nsa8.j4m"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdTyping (TypingData {tdStatus = StartedTyping}) + } + +testObject_Event_conversation_9 :: Event +testObject_Event_conversation_9 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "743846p6-pp33.1.ktb9.0bmn.efm2bly"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "9--5grmn.j39y3--9n"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = + EdMembersLeave + ( QualifiedUserIdList + { qualifiedUserIdList = + [ Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "ow8i3fhr.v"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "8kshw-2l.3w44.6c8763a-77r4.gk13zq"}}, + Qualified + { qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), + qDomain = Domain {_domainText = "xk-no.m5--f8b7"} + }, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "x02.p.69y-6.8ncr.u"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "1-47tume1e5l32i.v75is-q4-o.u7qc"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "8ay.ec.k-8"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "u-8.m-42ns2c"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "08kh83-8.vu.i24"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "t1t683.o3--2.3k5.it-5.e1"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "q.ajw-5"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "73m4g.c24em3.v"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "i7zn.li"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "42y78.yekf"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "n63-p87m2.dtq"}}, + Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "ns.v2p"}} + ] + } + ) + } + +testObject_Event_conversation_10 :: Event +testObject_Event_conversation_10 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "1852a.o-4"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "4-p.d7b8d3.6.c8--jds3-1acy"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdMLSMessage "s\b\138w\236\231P(\ESC\216\205" + } + +testObject_Event_conversation_11 :: Event +testObject_Event_conversation_11 = + Event + { evtConv = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "wwzw-ly4jk5.6790-y.j04o-21.ltl"}}, + evtFrom = Qualified {qUnqualified = Id (fromJust (UUID.fromString "2126ea99-ca79-43ea-ad99-a59616468e8e")), qDomain = Domain {_domainText = "70-o.ncd"}}, + evtTime = UTCTime {utctDay = ModifiedJulianDay 58119, utctDayTime = 0}, + evtData = EdTyping (TypingData {tdStatus = StoppedTyping}) + } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_featureConfig.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_featureConfig.hs new file mode 100644 index 00000000000..63733de48b3 --- /dev/null +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_featureConfig.hs @@ -0,0 +1,54 @@ +{-# LANGUAGE OverloadedLists #-} + +-- This file is part of the Wire Server implementation. +-- +-- Copyright (C) 2022 Wire Swiss GmbH +-- +-- This program is free software: you can redistribute it and/or modify it under +-- the terms of the GNU Affero 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 Affero General Public License for more +-- details. +-- +-- You should have received a copy of the GNU Affero General Public License along +-- with this program. If not, see . + +module Test.Wire.API.Golden.Generated.Event_featureConfig where + +import Data.Aeson +import GHC.Exts (IsList (fromList)) +import Wire.API.Event.FeatureConfig + +testObject_Event_featureConfig_1 :: Event +testObject_Event_featureConfig_1 = Event {_eventType = Update, _eventFeatureName = "", _eventData = Object (fromList [("config", Object (fromList [("domains", Array [])])), ("lockStatus", String "unlocked"), ("status", String "enabled"), ("ttl", String "unlimited")])} + +testObject_Event_featureConfig_2 :: Event +testObject_Event_featureConfig_2 = Event {_eventType = Update, _eventFeatureName = "\DLE", _eventData = Object (fromList [("lockStatus", String "locked"), ("status", String "disabled"), ("ttl", String "unlimited")])} + +testObject_Event_featureConfig_3 :: Event +testObject_Event_featureConfig_3 = Event {_eventType = Update, _eventFeatureName = "4\988540%\ETX", _eventData = Object (fromList [("lockStatus", String "locked"), ("status", String "disabled"), ("ttl", String "unlimited")])} + +testObject_Event_featureConfig_4 :: Event +testObject_Event_featureConfig_4 = Event {_eventType = Update, _eventFeatureName = "n(\1041492>\b", _eventData = Object (fromList [("lockStatus", String "locked"), ("status", String "disabled"), ("ttl", Number 6.0)])} + +testObject_Event_featureConfig_5 :: Event +testObject_Event_featureConfig_5 = Event {_eventType = Update, _eventFeatureName = "\1002596T\n\1092227X", _eventData = Object (fromList [("lockStatus", String "locked"), ("status", String "disabled"), ("ttl", String "unlimited")])} + +testObject_Event_featureConfig_6 :: Event +testObject_Event_featureConfig_6 = Event {_eventType = Update, _eventFeatureName = "\1039478\1022562)TXC\52414\174655K", _eventData = Object (fromList [("lockStatus", String "locked"), ("status", String "enabled"), ("ttl", Number 7.0)])} + +testObject_Event_featureConfig_7 :: Event +testObject_Event_featureConfig_7 = Event {_eventType = Update, _eventFeatureName = "\DEL+\1070185\190816\&9\52178\nW", _eventData = Object (fromList [("lockStatus", String "unlocked"), ("status", String "enabled"), ("ttl", Number 9.0)])} + +testObject_Event_featureConfig_8 :: Event +testObject_Event_featureConfig_8 = Event {_eventType = Update, _eventFeatureName = "7\DLEq-w\11345\DLE B\1028119H\n\DC2R\b", _eventData = Object (fromList [("config", Object (fromList [("enforcedTimeoutSeconds", Number 32.0)])), ("lockStatus", String "locked"), ("status", String "disabled"), ("ttl", Number 3.0)])} + +testObject_Event_featureConfig_9 :: Event +testObject_Event_featureConfig_9 = Event {_eventType = Update, _eventFeatureName = "\18889\20273d\1004321r\GSd'L\63854\SUB,\26907\SOH{@", _eventData = Object (fromList [("lockStatus", String "locked"), ("status", String "disabled"), ("ttl", Number 16.0)])} + +testObject_Event_featureConfig_10 :: Event +testObject_Event_featureConfig_10 = Event {_eventType = Update, _eventFeatureName = "\1105858'\1002071\&1S=\1058029u\1103881\10729:}\SUB#f\u0008", + "type": "feature-config.update" +} diff --git a/libs/wire-api/test/golden/testObject_Event_featureConfig_5.json b/libs/wire-api/test/golden/testObject_Event_featureConfig_5.json new file mode 100644 index 00000000000..a297f463f1d --- /dev/null +++ b/libs/wire-api/test/golden/testObject_Event_featureConfig_5.json @@ -0,0 +1,9 @@ +{ + "data": { + "lockStatus": "locked", + "status": "disabled", + "ttl": "unlimited" + }, + "name": "󴱤T\n􊪃X", + "type": "feature-config.update" +} diff --git a/libs/wire-api/test/golden/testObject_Event_featureConfig_6.json b/libs/wire-api/test/golden/testObject_Event_featureConfig_6.json new file mode 100644 index 00000000000..da07ae87082 --- /dev/null +++ b/libs/wire-api/test/golden/testObject_Event_featureConfig_6.json @@ -0,0 +1,9 @@ +{ + "data": { + "lockStatus": "locked", + "status": "enabled", + "ttl": 7 + }, + "name": "󽱶󹩢)TXC첾𪨿K", + "type": "feature-config.update" +} diff --git a/libs/wire-api/test/golden/testObject_Event_featureConfig_7.json b/libs/wire-api/test/golden/testObject_Event_featureConfig_7.json new file mode 100644 index 00000000000..42ba1027ece --- /dev/null +++ b/libs/wire-api/test/golden/testObject_Event_featureConfig_7.json @@ -0,0 +1,9 @@ +{ + "data": { + "lockStatus": "unlocked", + "status": "enabled", + "ttl": 9 + }, + "name": "+􅑩𮥠9쯒\nW", + "type": "feature-config.update" +} diff --git a/libs/wire-api/test/golden/testObject_Event_featureConfig_8.json b/libs/wire-api/test/golden/testObject_Event_featureConfig_8.json new file mode 100644 index 00000000000..b548d6d82b8 --- /dev/null +++ b/libs/wire-api/test/golden/testObject_Event_featureConfig_8.json @@ -0,0 +1,12 @@ +{ + "data": { + "config": { + "enforcedTimeoutSeconds": 32 + }, + "lockStatus": "locked", + "status": "disabled", + "ttl": 3 + }, + "name": "7\u0010q-wⱑ\u0010 B󻀗H\n\u0012R\u0008", + "type": "feature-config.update" +} diff --git a/libs/wire-api/test/golden/testObject_Event_featureConfig_9.json b/libs/wire-api/test/golden/testObject_Event_featureConfig_9.json new file mode 100644 index 00000000000..00e9648b07b --- /dev/null +++ b/libs/wire-api/test/golden/testObject_Event_featureConfig_9.json @@ -0,0 +1,9 @@ +{ + "data": { + "lockStatus": "locked", + "status": "disabled", + "ttl": 16 + }, + "name": "䧉伱d󵌡r\u001dd'L葉\u001a,椛\u0001{@", + "type": "feature-config.update" +} diff --git a/libs/wire-api/wire-api.cabal b/libs/wire-api/wire-api.cabal index 75e296c708a..9eb165fc385 100644 --- a/libs/wire-api/wire-api.cabal +++ b/libs/wire-api/wire-api.cabal @@ -357,6 +357,8 @@ test-suite wire-api-golden-tests Test.Wire.API.Golden.Generated.Email_user Test.Wire.API.Golden.Generated.EmailUpdate_provider Test.Wire.API.Golden.Generated.EmailUpdate_user + Test.Wire.API.Golden.Generated.Event_conversation + Test.Wire.API.Golden.Generated.Event_featureConfig Test.Wire.API.Golden.Generated.Event_team Test.Wire.API.Golden.Generated.Event_user Test.Wire.API.Golden.Generated.EventType_team From 11ac4e31a21bd59e3f9af6f34d76e2902ef08629 Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Tue, 22 Nov 2022 15:55:53 +0000 Subject: [PATCH 2/2] changelog --- changelog.d/5-internal/pr-2861 | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5-internal/pr-2861 diff --git a/changelog.d/5-internal/pr-2861 b/changelog.d/5-internal/pr-2861 new file mode 100644 index 00000000000..226e80aa78d --- /dev/null +++ b/changelog.d/5-internal/pr-2861 @@ -0,0 +1 @@ +Golden tests for conversation and feature config event schemas