test_: activity center notifications (#6337)

* test_: activity center notifications

* test_: small fix

* test_: changes according to review
This commit is contained in:
Yevheniia Berdnyk 2025-02-12 19:31:35 +02:00 committed by GitHub
parent 3e435221ce
commit 157d6eb1bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 2117 additions and 27 deletions

View File

@ -0,0 +1,284 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"properties": {
"activityCenterState": {
"properties": {
"hasSeen": {
"type": "boolean"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"hasSeen",
"updatedAt"
],
"type": "object"
},
"chats": {
"items": {
"properties": {
"ReadMessagesAtClockValue": {
"type": "integer"
},
"active": {
"type": "boolean"
},
"alias": {
"type": "string"
},
"chatType": {
"type": "integer"
},
"color": {
"type": "string"
},
"deletedAtClockValue": {
"type": "integer"
},
"description": {
"type": "string"
},
"emoji": {
"type": "string"
},
"highlight": {
"type": "boolean"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"joined": {
"type": "integer"
},
"lastClockValue": {
"type": "integer"
},
"lastMessage": {
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contactRequestState": {
"type": "integer"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"new": {
"type": "boolean"
},
"parsedText": {
"items": {
"properties": {
"children": {
"items": {
"properties": {
"literal": {
"type": "string"
}
},
"required": [
"literal"
],
"type": "object"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"type": "array"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contactRequestState",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"new",
"parsedText",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
},
"members": {
"type": "null"
},
"membershipUpdateEvents": {
"type": "null"
},
"muteTill": {
"type": "string"
},
"muted": {
"type": "boolean"
},
"name": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"unviewedMentionsCount": {
"type": "integer"
},
"unviewedMessagesCount": {
"type": "integer"
},
"viewersCanPostReactions": {
"type": "boolean"
}
},
"required": [
"ReadMessagesAtClockValue",
"active",
"alias",
"chatType",
"color",
"deletedAtClockValue",
"description",
"emoji",
"highlight",
"id",
"identicon",
"joined",
"lastClockValue",
"lastMessage",
"members",
"membershipUpdateEvents",
"muteTill",
"muted",
"name",
"timestamp",
"unviewedMentionsCount",
"unviewedMessagesCount",
"viewersCanPostReactions"
],
"type": "object"
},
"type": "array"
},
"discordOldestMessageTimestamp": {
"type": "integer"
},
"notifications": {
"type": "null"
}
},
"required": [
"activityCenterState",
"chats",
"discordOldestMessageTimestamp",
"notifications"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -1,33 +1,378 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "http://example.com/example.json",
"type": "object",
"required": [
"id",
"jsonrpc",
"result"
],
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "string"
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"type": "object",
"required": [
"cursor",
"notifications"
],
"properties": {
"cursor": {
"type": "string"
},
"notifications": {
"items": {
"properties": {
"accepted": {
"type": "boolean"
},
"albumMessages": {
"type": "null"
},
"author": {
"type": "string"
},
"chatId": {
"type": "string"
},
"communityId": {
"type": "string"
},
"contactVerificationStatus": {
"type": "integer"
},
"deleted": {
"type": "boolean"
},
"dismissed": {
"type": "boolean"
},
"id": {
"type": "string"
},
"installationId": {
"type": "string"
},
"lastMessage": {
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contactRequestState": {
"type": "integer"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"new": {
"type": "boolean"
},
"parsedText": {
"items": {
"properties": {
"children": {
"items": {
"properties": {
"literal": {
"type": "string"
}
},
"required": [
"literal"
],
"type": "object"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"type": "array"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
},
"membershipStatus": {
"type": "integer"
},
"message": {
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contactRequestState": {
"type": "integer"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"parsedText": {
"items": {
"properties": {
"children": {
"items": {
"properties": {
"literal": {
"type": "string"
}
},
"required": [
"literal"
],
"type": "object"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"type": "array"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contactRequestState",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"parsedText",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
},
"name": {
"type": "string"
},
"read": {
"type": "boolean"
},
"replyMessage": {
"type": "null"
},
"timestamp": {
"type": "integer"
},
"tokenData": {
"type": "null"
},
"type": {
"type": "integer"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"accepted",
"albumMessages",
"author",
"chatId",
"communityId",
"contactVerificationStatus",
"deleted",
"dismissed",
"id",
"installationId",
"lastMessage",
"membershipStatus",
"message",
"name",
"read",
"replyMessage",
"timestamp",
"tokenData",
"type",
"updatedAt"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"cursor",
"notifications"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,68 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"properties": {
"1": {
"type": "integer"
},
"10": {
"type": "integer"
},
"2": {
"type": "integer"
},
"23": {
"type": "integer"
},
"24": {
"type": "integer"
},
"3": {
"type": "integer"
},
"4": {
"type": "integer"
},
"5": {
"type": "integer"
},
"7": {
"type": "integer"
},
"8": {
"type": "integer"
},
"9": {
"type": "integer"
}
},
"required": [
"1",
"10",
"2",
"23",
"24",
"3",
"4",
"5",
"7",
"8",
"9"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"type": "null"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"type": "null"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,32 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"properties": {
"hasSeen": {
"type": "boolean"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"hasSeen",
"updatedAt"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"type": "boolean"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,371 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"properties": {
"activityCenterNotifications": {
"items": {
"properties": {
"accepted": {
"type": "boolean"
},
"albumMessages": {
"type": "null"
},
"author": {
"type": "string"
},
"chatId": {
"type": "string"
},
"communityId": {
"type": "string"
},
"contactVerificationStatus": {
"type": "integer"
},
"deleted": {
"type": "boolean"
},
"dismissed": {
"type": "boolean"
},
"id": {
"type": "string"
},
"installationId": {
"type": "string"
},
"lastMessage": {
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
},
"membershipStatus": {
"type": "integer"
},
"message": {
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contactRequestState": {
"type": "integer"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"gapParameters": {
"type": "object"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"outgoingStatus": {
"type": "string"
},
"parsedText": {
"items": {
"properties": {
"children": {
"items": {
"properties": {
"literal": {
"type": "string"
}
},
"required": [
"literal"
],
"type": "object"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"type": "array"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contactRequestState",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"gapParameters",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"outgoingStatus",
"parsedText",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
},
"name": {
"type": "string"
},
"read": {
"type": "boolean"
},
"replyMessage": {
"type": "null"
},
"timestamp": {
"type": "integer"
},
"tokenData": {
"type": "null"
},
"type": {
"type": "integer"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"accepted",
"albumMessages",
"author",
"chatId",
"communityId",
"contactVerificationStatus",
"deleted",
"dismissed",
"id",
"installationId",
"lastMessage",
"membershipStatus",
"message",
"name",
"read",
"replyMessage",
"timestamp",
"tokenData",
"type",
"updatedAt"
],
"type": "object"
},
"type": "array"
},
"activityCenterState": {
"properties": {
"hasSeen": {
"type": "boolean"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"hasSeen",
"updatedAt"
],
"type": "object"
},
"discordOldestMessageTimestamp": {
"type": "integer"
},
"notifications": {
"type": "null"
}
},
"required": [
"activityCenterNotifications",
"activityCenterState",
"discordOldestMessageTimestamp",
"notifications"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,276 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"properties": {
"activityCenterNotifications": {
"items": {
"properties": {
"accepted": {
"type": "boolean"
},
"albumMessages": {
"type": "null"
},
"author": {
"type": "string"
},
"chatId": {
"type": "string"
},
"communityId": {
"type": "string"
},
"contactVerificationStatus": {
"type": "integer"
},
"deleted": {
"type": "boolean"
},
"dismissed": {
"type": "boolean"
},
"id": {
"type": "string"
},
"installationId": {
"type": "string"
},
"lastMessage": {
"type": "null"
},
"membershipStatus": {
"type": "integer"
},
"message": {
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contactRequestState": {
"type": "integer"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"gapParameters": {
"type": "object"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"outgoingStatus": {
"type": "string"
},
"parsedText": {
"items": {
"properties": {
"children": {
"items": {
"properties": {
"literal": {
"type": "string"
}
},
"required": [
"literal"
],
"type": "object"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"type": "array"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contactRequestState",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"gapParameters",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"outgoingStatus",
"parsedText",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
},
"name": {
"type": "string"
},
"read": {
"type": "boolean"
},
"replyMessage": {
"type": "null"
},
"timestamp": {
"type": "integer"
},
"tokenData": {
"type": "null"
},
"type": {
"type": "integer"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"accepted",
"albumMessages",
"author",
"chatId",
"communityId",
"contactVerificationStatus",
"deleted",
"dismissed",
"id",
"installationId",
"lastMessage",
"membershipStatus",
"message",
"name",
"read",
"replyMessage",
"timestamp",
"tokenData",
"type",
"updatedAt"
],
"type": "object"
},
"type": "array"
},
"activityCenterState": {
"properties": {
"hasSeen": {
"type": "boolean"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"hasSeen",
"updatedAt"
],
"type": "object"
},
"discordOldestMessageTimestamp": {
"type": "integer"
},
"notifications": {
"type": "null"
}
},
"required": [
"activityCenterNotifications",
"activityCenterState",
"discordOldestMessageTimestamp",
"notifications"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,415 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"properties": {
"activityCenterNotifications": {
"items": {
"properties": {
"accepted": {
"type": "boolean"
},
"albumMessages": {
"type": "null"
},
"author": {
"type": "string"
},
"chatId": {
"type": "string"
},
"communityId": {
"type": "string"
},
"contactVerificationStatus": {
"type": "integer"
},
"deleted": {
"type": "boolean"
},
"dismissed": {
"type": "boolean"
},
"id": {
"type": "string"
},
"installationId": {
"type": "string"
},
"lastMessage": {
"anyOf": [
{
"type": "null"
},
{
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contactRequestState": {
"type": "integer"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"new": {
"type": "boolean"
},
"parsedText": {
"items": {
"properties": {
"children": {
"items": {
"properties": {
"literal": {
"type": "string"
}
},
"required": [
"literal"
],
"type": "object"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"type": "array"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contactRequestState",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"new",
"parsedText",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
}
]
},
"membershipStatus": {
"type": "integer"
},
"message": {
"anyOf": [
{
"type": "null"
},
{
"properties": {
"alias": {
"type": "string"
},
"chatId": {
"type": "string"
},
"clock": {
"type": "integer"
},
"compressedKey": {
"type": "string"
},
"contactRequestState": {
"type": "integer"
},
"contentType": {
"type": "integer"
},
"displayName": {
"type": "string"
},
"emojiHash": {
"items": {
"type": "string"
},
"type": "array"
},
"ensName": {
"type": "string"
},
"from": {
"type": "string"
},
"id": {
"type": "string"
},
"identicon": {
"type": "string"
},
"lineCount": {
"type": "integer"
},
"localChatId": {
"type": "string"
},
"messageType": {
"type": "integer"
},
"parsedText": {
"items": {
"properties": {
"children": {
"items": {
"properties": {
"literal": {
"type": "string"
}
},
"required": [
"literal"
],
"type": "object"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"type": "array"
},
"quotedMessage": {
"type": "null"
},
"replace": {
"type": "string"
},
"responseTo": {
"type": "string"
},
"rtl": {
"type": "boolean"
},
"seen": {
"type": "boolean"
},
"text": {
"type": "string"
},
"timestamp": {
"type": "integer"
},
"whisperTimestamp": {
"type": "integer"
}
},
"required": [
"alias",
"chatId",
"clock",
"compressedKey",
"contactRequestState",
"contentType",
"displayName",
"emojiHash",
"ensName",
"from",
"id",
"identicon",
"lineCount",
"localChatId",
"messageType",
"parsedText",
"quotedMessage",
"replace",
"responseTo",
"rtl",
"seen",
"text",
"timestamp",
"whisperTimestamp"
],
"type": "object"
}
]
},
"name": {
"type": "string"
},
"read": {
"type": "boolean"
},
"replyMessage": {
"type": "null"
},
"timestamp": {
"type": "integer"
},
"tokenData": {
"type": "null"
},
"type": {
"type": "integer"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"accepted",
"albumMessages",
"author",
"chatId",
"communityId",
"contactVerificationStatus",
"deleted",
"dismissed",
"id",
"installationId",
"lastMessage",
"membershipStatus",
"message",
"name",
"read",
"replyMessage",
"timestamp",
"tokenData",
"type",
"updatedAt"
],
"type": "object"
},
"type": "array"
},
"activityCenterState": {
"properties": {
"hasSeen": {
"type": "boolean"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"hasSeen",
"updatedAt"
],
"type": "object"
},
"discordOldestMessageTimestamp": {
"type": "integer"
},
"notifications": {
"type": "null"
}
},
"required": [
"activityCenterNotifications",
"activityCenterState",
"discordOldestMessageTimestamp",
"notifications"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "integer"
},
"jsonrpc": {
"type": "string"
},
"result": {
"properties": {
"activityCenterState": {
"properties": {
"hasSeen": {
"type": "boolean"
},
"updatedAt": {
"type": "integer"
}
},
"required": [
"hasSeen",
"updatedAt"
],
"type": "object"
},
"discordOldestMessageTimestamp": {
"type": "integer"
},
"notifications": {
"type": "null"
}
},
"required": [
"activityCenterState",
"discordOldestMessageTimestamp",
"notifications"
],
"type": "object"
}
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}

View File

@ -0,0 +1,186 @@
from typing import Union
import pytest
from clients.status_backend import StatusBackend
from tests.test_cases import MessengerTestCase
def _get_activity_center_notifications(
backend_instance: StatusBackend, activity_types: list = [1, 2, 3, 4, 5, 7, 8, 9, 10, 23, 24], read_type: Union[int, None] = None
):
params = {"cursor": "", "limit": 20, "activityTypes": activity_types}
if read_type:
params["readType"] = read_type
return backend_instance.wakuext_service.rpc_request(method="activityCenterNotifications", params=[params]).json()
@pytest.mark.usefixtures("setup_two_unprivileged_nodes")
@pytest.mark.rpc
class TestActivityCenterNotifications(MessengerTestCase):
def test_activity_center_notifications(self):
message_id = self.send_contact_request_and_wait_for_signal_to_be_received()
response = _get_activity_center_notifications(backend_instance=self.receiver, activity_types=[5], read_type=2)
self.receiver.verify_json_schema(response, method="wakuext_activityCenterNotifications")
notification = response["result"]["notifications"][0]
assert all(
(
notification["accepted"] is False,
notification["author"] == self.sender.public_key,
notification["chatId"] == self.sender.public_key,
notification["id"] == message_id,
notification["read"] is False,
notification["lastMessage"]["contactRequestState"] == 1,
)
)
self.accept_contact_request_and_wait_for_signal_to_be_received(message_id)
response = _get_activity_center_notifications(backend_instance=self.sender)
self.sender.verify_json_schema(response, method="wakuext_activityCenterNotifications")
notification = response["result"]["notifications"][0]
assert all(
(
notification["accepted"] is True,
notification["author"] == self.sender.public_key,
notification["chatId"] == self.receiver.public_key,
notification["id"] == message_id,
notification["read"] is True,
notification["message"]["contactRequestState"] == 2,
notification["lastMessage"]["text"] == f"@{self.receiver.public_key} accepted your contact request",
)
)
def test_activity_center_notifications_count(self):
self.send_contact_request_and_wait_for_signal_to_be_received()
response = self.receiver.wakuext_service.rpc_request(
method="activityCenterNotificationsCount", params=[{"activityTypes": [1, 2, 3, 4, 5, 7, 8, 9, 10, 23, 24], "readType": 2}]
).json()
self.receiver.verify_json_schema(response, method="wakuext_activityCenterNotificationsCount")
assert response["result"]["5"] == 1
def test_seen_unseen_activity_center_notifications(self):
self.send_contact_request_and_wait_for_signal_to_be_received()
response = self.receiver.wakuext_service.rpc_request(method="hasUnseenActivityCenterNotifications").json()
self.receiver.verify_json_schema(response, method="wakuext_hasUnseenActivityCenterNotifications")
assert response["result"] is True
response = self.receiver.wakuext_service.rpc_request(method="markAsSeenActivityCenterNotifications").json()
self.receiver.verify_json_schema(response, method="wakuext_markAsSeenActivityCenterNotifications")
response = self.receiver.wakuext_service.rpc_request(method="hasUnseenActivityCenterNotifications").json()
self.receiver.verify_json_schema(response, method="wakuext_hasUnseenActivityCenterNotifications")
assert response["result"] is False
def test_get_activity_center_state(self):
self.send_contact_request_and_wait_for_signal_to_be_received()
response = self.receiver.wakuext_service.rpc_request(method="getActivityCenterState").json()
self.receiver.verify_json_schema(response, method="wakuext_getActivityCenterState")
assert response["result"]["hasSeen"] is False
self.receiver.wakuext_service.rpc_request(method="markAsSeenActivityCenterNotifications").json()
response = self.receiver.wakuext_service.rpc_request(method="getActivityCenterState").json()
assert response["result"]["hasSeen"] is True
def test_mark_all_activity_center_notifications_read(self):
message_id = self.send_contact_request_and_wait_for_signal_to_be_received()
response = self.receiver.wakuext_service.rpc_request(method="markAllActivityCenterNotificationsRead").json()
self.receiver.verify_json_schema(response, method="wakuext_markAllActivityCenterNotificationsRead")
assert all(
(
response["result"]["activityCenterState"]["hasSeen"] is True,
response["result"]["activityCenterNotifications"][0]["id"] == message_id,
response["result"]["activityCenterNotifications"][0]["read"] is True,
)
)
response = self.receiver.wakuext_service.rpc_request(method="hasUnseenActivityCenterNotifications").json()
assert response["result"] is False
def test_mark_activity_center_notifications_read_unread(self):
message_id = self.make_contacts()
response = self.sender.wakuext_service.rpc_request(
method="markActivityCenterNotificationsRead",
params=[
[
message_id,
],
],
).json()
self.sender.verify_json_schema(response, method="wakuext_markActivityCenterNotificationsRead")
assert all(
(
response["result"]["activityCenterNotifications"][0]["id"] == message_id,
response["result"]["activityCenterNotifications"][0]["read"] is True,
)
)
result = _get_activity_center_notifications(backend_instance=self.sender, activity_types=[5])["result"]
assert result["notifications"][0]["read"] is True
response = self.sender.wakuext_service.rpc_request(
method="markActivityCenterNotificationsUnread",
params=[
[
message_id,
],
],
).json()
self.sender.verify_json_schema(response, method="wakuext_markActivityCenterNotificationsUnread")
assert all(
(
response["result"]["activityCenterState"]["hasSeen"] is False,
response["result"]["activityCenterNotifications"][0]["id"] == message_id,
response["result"]["activityCenterNotifications"][0]["read"] is False,
)
)
result = _get_activity_center_notifications(backend_instance=self.sender, activity_types=[5])["result"]
assert result["notifications"][0]["read"] is False
def test_accept_activity_center_notifications(self):
message_id = self.send_contact_request_and_wait_for_signal_to_be_received()
response = self.receiver.wakuext_service.rpc_request(
method="acceptActivityCenterNotifications",
params=[
[
message_id,
],
],
).json()
self.receiver.verify_json_schema(response, method="wakuext_acceptActivityCenterNotifications")
result = _get_activity_center_notifications(backend_instance=self.receiver)["result"]
assert all((result["notifications"][0]["accepted"] is True, result["notifications"][0]["id"] == message_id))
def test_dismiss_activity_center_notifications(self):
message_id = self.send_contact_request_and_wait_for_signal_to_be_received()
response = self.receiver.wakuext_service.rpc_request(
method="dismissActivityCenterNotifications",
params=[
[
message_id,
],
],
).json()
self.receiver.verify_json_schema(response, method="wakuext_dismissActivityCenterNotifications")
result = _get_activity_center_notifications(backend_instance=self.receiver)["result"]
assert all((result["notifications"][0]["dismissed"] is True, result["notifications"][0]["id"] == message_id))
def test_delete_activity_center_notifications(self):
message_id = self.make_contacts()
result = _get_activity_center_notifications(backend_instance=self.sender)["result"]
assert len(result["notifications"]) == 1
response = self.sender.wakuext_service.rpc_request(
method="deleteActivityCenterNotifications",
params=[
[
message_id,
],
],
).json()
self.sender.verify_json_schema(response, method="wakuext_deleteActivityCenterNotifications")
result = _get_activity_center_notifications(backend_instance=self.sender)["result"]
assert not result["notifications"]

View File

@ -227,18 +227,27 @@ class MessengerTestCase(NetworkConditionTestCase):
backend.wakuext_service.start_messenger()
return backend
def send_contact_request_and_wait_for_signal_to_be_received(self):
response = self.sender.wakuext_service.send_contact_request(self.receiver.public_key, "contact_request")
expected_message = self.get_message_by_content_type(response, content_type=MessageContentType.CONTACT_REQUEST.value)[0]
message_id = expected_message.get("id")
self.receiver.find_signal_containing_pattern(SignalType.MESSAGES_NEW.value, event_pattern=message_id)
return message_id
def accept_contact_request_and_wait_for_signal_to_be_received(self, message_id):
self.receiver.wakuext_service.accept_contact_request(message_id)
accepted_signal = f"@{self.receiver.public_key} accepted your contact request"
self.sender.find_signal_containing_pattern(SignalType.MESSAGES_NEW.value, event_pattern=accepted_signal)
def make_contacts(self):
existing_contacts = self.receiver.wakuext_service.get_contacts()
if self.sender.public_key in str(existing_contacts):
return
response = self.sender.wakuext_service.send_contact_request(self.receiver.public_key, "contact_request")
expected_message = self.get_message_by_content_type(response, content_type=MessageContentType.CONTACT_REQUEST.value)[0]
self.receiver.find_signal_containing_pattern(SignalType.MESSAGES_NEW.value, event_pattern=expected_message.get("id"))
self.receiver.wakuext_service.accept_contact_request(expected_message.get("id"))
accepted_signal = f"@{self.receiver.public_key} accepted your contact request"
self.sender.find_signal_containing_pattern(SignalType.MESSAGES_NEW.value, event_pattern=accepted_signal)
message_id = self.send_contact_request_and_wait_for_signal_to_be_received()
self.accept_contact_request_and_wait_for_signal_to_be_received(message_id)
return message_id
def validate_signal_event_against_response(self, signal_event, fields_to_validate, expected_message):
expected_message_id = expected_message.get("id")

View File

@ -9,10 +9,6 @@ class TestRpc(StatusBackendTestCase):
"method, params",
[
("wakuext_peers", []),
(
"wakuext_activityCenterNotifications",
[{"cursor": "", "limit": 20, "activityTypes": [5], "readType": 2}],
),
],
)
def test_(self, method, params):