-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases for SMS standard messages
- Loading branch information
1 parent
b1c9a31
commit a18c914
Showing
32 changed files
with
2,096 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
46 changes: 46 additions & 0 deletions
46
src/main/kotlin/tests/ChatItemStandardMessageSmsTestCase.kt
This file contains 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,46 @@ | ||
package tests | ||
|
||
import PermutationScope | ||
import TestCase | ||
import org.thoughtcrime.securesms.backup.v2.proto.ChatItem | ||
import org.thoughtcrime.securesms.backup.v2.proto.Frame | ||
import org.thoughtcrime.securesms.backup.v2.proto.StandardMessage | ||
import org.thoughtcrime.securesms.backup.v2.proto.Text | ||
|
||
/** | ||
* Incoming/outgoing text-only messages. | ||
*/ | ||
object ChatItemStandardMessageSmsTestCase : TestCase("chat_item_standard_message_sms") { | ||
|
||
override fun PermutationScope.execute() { | ||
frames += StandardFrames.MANDATORY_FRAMES | ||
|
||
frames += StandardFrames.recipientAlice | ||
frames += StandardFrames.chatAlice | ||
|
||
val (incomingGenerator, outgoingGenerator) = Generators.incomingOutgoingDetails(StandardFrames.recipientAlice.recipient!!) | ||
|
||
val incoming = some(incomingGenerator) | ||
val outgoing = some(outgoingGenerator) | ||
|
||
frames += Frame( | ||
chatItem = ChatItem( | ||
chatId = StandardFrames.chatAlice.chat!!.id, | ||
authorId = if (outgoing != null) { | ||
StandardFrames.recipientSelf.recipient!!.id | ||
} else { | ||
StandardFrames.recipientAlice.recipient!!.id | ||
}, | ||
dateSent = someIncrementingTimestamp(), | ||
incoming = incoming, | ||
outgoing = outgoing, | ||
sms = someBoolean(), | ||
standardMessage = StandardMessage( | ||
text = Text( | ||
body = someNonEmptyString() | ||
) | ||
) | ||
) | ||
) | ||
} | ||
} |
Binary file not shown.
This file contains 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,134 @@ | ||
// This file was auto-generated! It's only meant to show you what's in the .binproto. Do not edit! | ||
|
||
BackupInfo { | ||
backupTimeMs = 1715636551000 | ||
version = 1 | ||
} | ||
|
||
Frame { | ||
account = AccountData { | ||
accountSettings = AccountSettings { | ||
customChatColors = [ | ||
CustomChatColor { | ||
id = 1 | ||
solid = -16777216 | ||
}, | ||
CustomChatColor { | ||
id = 2 | ||
solid = -65536 | ||
}, | ||
CustomChatColor { | ||
id = 3 | ||
solid = -16711936 | ||
} | ||
] | ||
displayBadgesOnProfile = true | ||
hasCompletedUsernameOnboarding = true | ||
hasSeenGroupStoryEducationSheet = true | ||
hasSetMyStoriesPrivacy = true | ||
hasViewedOnboardingStory = true | ||
keepMutedChatsArchived = true | ||
linkPreviews = true | ||
notDiscoverableByPhoneNumber = true | ||
phoneNumberSharingMode = PhoneNumberSharingMode.NOBODY | ||
preferContactAvatars = true | ||
preferredReactionEmoji = [ | ||
"a", | ||
"b", | ||
"c" | ||
] | ||
readReceipts = true | ||
sealedSenderIndicators = true | ||
storiesDisabled = true | ||
storyViewReceiptsEnabled = true | ||
typingIndicators = true | ||
universalExpireTimerSeconds = 3600 | ||
} | ||
avatarUrlPath = "" | ||
donationSubscriberData = SubscriberData { | ||
currencyCode = "USD" | ||
manuallyCancelled = true | ||
subscriberId = <ecbb68c734331a2ea333cda747c98c4553652261582b4fce5ae0dea84dce6519> | ||
} | ||
familyName = "Fett" | ||
givenName = "Boba" | ||
profileKey = <610291abedc34249489da39a31c9a5cd99cdd26ff58732e268e357ee0075d9d8> | ||
username = "boba_fett.66" | ||
usernameLink = UsernameLink { | ||
color = Color.OLIVE | ||
entropy = <65675c73d00eb01005e3bb7c4a47f296cb6554f78981238815e915d824fd2e93> | ||
serverId = <61c101a200d5421789c20518d8497af0> | ||
} | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
id = 1 | ||
self = Self {} | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
id = 2 | ||
releaseNotes = ReleaseNotes {} | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
distributionList = DistributionListItem { | ||
distributionId = <00000000000000000000000000000000> | ||
distributionList = DistributionList { | ||
name = "" | ||
privacyMode = PrivacyMode.ALL | ||
} | ||
} | ||
id = 3 | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
contact = Contact { | ||
aci = <000a11ce000040008000000000000001> | ||
e164 = 16105550101 | ||
pni = <000a11ce000040008000000000000002> | ||
profileFamilyName = "Smith" | ||
profileGivenName = "Alice" | ||
profileKey = <d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d> | ||
registered = Registered {} | ||
visibility = Visibility.VISIBLE | ||
} | ||
id = 4 | ||
} | ||
} | ||
|
||
Frame { | ||
chat = Chat { | ||
expireTimerVersion = 1 | ||
id = 2 | ||
recipientId = 4 | ||
} | ||
} | ||
|
||
Frame { | ||
chatItem = ChatItem { | ||
authorId = 4 | ||
chatId = 2 | ||
dateSent = 1680366577838 | ||
incoming = IncomingMessageDetails { | ||
dateReceived = 1702291826269 | ||
dateServerSent = 1794124103201 | ||
read = true | ||
sealedSender = true | ||
} | ||
sms = true | ||
standardMessage = StandardMessage { | ||
text = Text { | ||
body = "pdiJZ" | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains 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,131 @@ | ||
// This file was auto-generated! It's only meant to show you what's in the .binproto. Do not edit! | ||
|
||
BackupInfo { | ||
backupTimeMs = 1715636551000 | ||
version = 1 | ||
} | ||
|
||
Frame { | ||
account = AccountData { | ||
accountSettings = AccountSettings { | ||
customChatColors = [ | ||
CustomChatColor { | ||
id = 1 | ||
solid = -16777216 | ||
}, | ||
CustomChatColor { | ||
id = 2 | ||
solid = -65536 | ||
}, | ||
CustomChatColor { | ||
id = 3 | ||
solid = -16711936 | ||
} | ||
] | ||
displayBadgesOnProfile = true | ||
hasCompletedUsernameOnboarding = true | ||
hasSeenGroupStoryEducationSheet = true | ||
hasSetMyStoriesPrivacy = true | ||
hasViewedOnboardingStory = true | ||
keepMutedChatsArchived = true | ||
linkPreviews = true | ||
notDiscoverableByPhoneNumber = true | ||
phoneNumberSharingMode = PhoneNumberSharingMode.NOBODY | ||
preferContactAvatars = true | ||
preferredReactionEmoji = [ | ||
"a", | ||
"b", | ||
"c" | ||
] | ||
readReceipts = true | ||
sealedSenderIndicators = true | ||
storiesDisabled = true | ||
storyViewReceiptsEnabled = true | ||
typingIndicators = true | ||
universalExpireTimerSeconds = 3600 | ||
} | ||
avatarUrlPath = "" | ||
donationSubscriberData = SubscriberData { | ||
currencyCode = "USD" | ||
manuallyCancelled = true | ||
subscriberId = <ecbb68c734331a2ea333cda747c98c4553652261582b4fce5ae0dea84dce6519> | ||
} | ||
familyName = "Fett" | ||
givenName = "Boba" | ||
profileKey = <610291abedc34249489da39a31c9a5cd99cdd26ff58732e268e357ee0075d9d8> | ||
username = "boba_fett.66" | ||
usernameLink = UsernameLink { | ||
color = Color.OLIVE | ||
entropy = <65675c73d00eb01005e3bb7c4a47f296cb6554f78981238815e915d824fd2e93> | ||
serverId = <61c101a200d5421789c20518d8497af0> | ||
} | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
id = 1 | ||
self = Self {} | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
id = 2 | ||
releaseNotes = ReleaseNotes {} | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
distributionList = DistributionListItem { | ||
distributionId = <00000000000000000000000000000000> | ||
distributionList = DistributionList { | ||
name = "" | ||
privacyMode = PrivacyMode.ALL | ||
} | ||
} | ||
id = 3 | ||
} | ||
} | ||
|
||
Frame { | ||
recipient = Recipient { | ||
contact = Contact { | ||
aci = <000a11ce000040008000000000000001> | ||
e164 = 16105550101 | ||
pni = <000a11ce000040008000000000000002> | ||
profileFamilyName = "Smith" | ||
profileGivenName = "Alice" | ||
profileKey = <d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d75d> | ||
registered = Registered {} | ||
visibility = Visibility.VISIBLE | ||
} | ||
id = 4 | ||
} | ||
} | ||
|
||
Frame { | ||
chat = Chat { | ||
expireTimerVersion = 1 | ||
id = 2 | ||
recipientId = 4 | ||
} | ||
} | ||
|
||
Frame { | ||
chatItem = ChatItem { | ||
authorId = 4 | ||
chatId = 2 | ||
dateSent = 1680366577839 | ||
incoming = IncomingMessageDetails { | ||
dateReceived = 1702291826270 | ||
dateServerSent = 1794124103202 | ||
} | ||
standardMessage = StandardMessage { | ||
text = Text { | ||
body = "YWfDTgpIJ" | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.