diff --git a/lib/src/protocol/notification.dart b/lib/src/protocol/notification.dart index 7f26482..9f9ae84 100644 --- a/lib/src/protocol/notification.dart +++ b/lib/src/protocol/notification.dart @@ -54,7 +54,7 @@ class Notification extends Envelope { } if (reason != null) { - notification[reasonKey] = describeEnum(reasonKey); + notification[reasonKey] = reason?.toJson(); } return notification; diff --git a/pubspec.lock b/pubspec.lock index ad3b701..b926d05 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,27 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "38.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "3.4.1" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" async: dependency: transitive description: @@ -15,6 +36,62 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + build: + dependency: transitive + description: + name: build + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" + build_config: + dependency: transitive + description: + name: build_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" + build_runner: + dependency: "direct dev" + description: + name: build_runner + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.10" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + url: "https://pub.dartlang.org" + source: hosted + version: "7.2.3" + built_collection: + dependency: transitive + description: + name: built_collection + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + url: "https://pub.dartlang.org" + source: hosted + version: "8.2.3" characters: dependency: transitive description: @@ -29,6 +106,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" clock: dependency: transitive description: @@ -36,6 +120,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + code_builder: + dependency: transitive + description: + name: code_builder + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" collection: dependency: transitive description: @@ -43,6 +134,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" crypto: dependency: transitive description: @@ -50,6 +148,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.1" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.3" fake_async: dependency: transitive description: @@ -57,6 +162,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.2" + fixnum: + dependency: transitive + description: + name: fixnum + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -74,6 +193,62 @@ packages: description: flutter source: sdk version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + graphs: + dependency: transitive + description: + name: graphs + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.4" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "4.5.0" lints: dependency: transitive description: @@ -109,6 +284,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + mockito: + dependency: "direct dev" + description: + name: mockito + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" path: dependency: transitive description: @@ -116,6 +312,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" + pool: + dependency: transitive + description: + name: pool + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.0" pretty_json: dependency: "direct main" description: @@ -123,6 +326,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + shelf: + dependency: transitive + description: + name: shelf + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" simple_logger: dependency: "direct main" description: @@ -135,6 +366,13 @@ packages: description: flutter source: sdk version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.2" source_span: dependency: transitive description: @@ -156,6 +394,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + stream_transform: + dependency: transitive + description: + name: stream_transform + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" string_scanner: dependency: transitive description: @@ -177,6 +422,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.8" + timing: + dependency: transitive + description: + name: timing + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" typed_data: dependency: transitive description: @@ -198,6 +450,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.16.0 <3.0.0" flutter: ">=1.17.0" diff --git a/pubspec.yaml b/pubspec.yaml index 52efe91..968d1b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + mockito: ^5.1.0 + build_runner: ^2.1.10 flutter_lints: ^1.0.0 -flutter: - diff --git a/test/protocol/client/client_channel_test.dart b/test/protocol/client/client_channel_test.dart new file mode 100644 index 0000000..0e2ff73 --- /dev/null +++ b/test/protocol/client/client_channel_test.dart @@ -0,0 +1,68 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:lime/lime.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'client_channel_test.mocks.dart'; + +@GenerateMocks([], + customMocks: [MockSpec(returnNullOnMissingStub: true)]) +void main() { + final mockWebSocketTransport = MockWebSocketTransport(); + + ClientChannel clientChannel = ClientChannel(mockWebSocketTransport); + + group('startNewSession', () { + test('should return a exception if state is not isNew', () { + clientChannel.state = SessionState.authenticating; + + expect(clientChannel.startNewSession(), throwsException); + verifyNever(mockWebSocketTransport.send(any)); + }); + test('should called the send at transport if session state is new', () { + clientChannel.state = SessionState.isNew; + + clientChannel.startNewSession(); + verify(mockWebSocketTransport.send(any)).called(1); + }); + }); + + group('authenticateSession', () { + test('should return a exception if state is not authenticating', () { + clientChannel.state = SessionState.isNew; + + expect( + clientChannel.authenticateSession('', '', ExternalAuthentication()), + throwsException); + verifyNever(mockWebSocketTransport.send(any)); + }); + test( + 'should called the send at transport if session state is authenticating', + () { + clientChannel.state = SessionState.authenticating; + + clientChannel.authenticateSession( + 'name@domain', + 'instance', + ExternalAuthentication( + token: 'eyJhbGciOiJSUzI1NiIsImtpZCI6IjRlY2RmZmV...', + issuer: 'account.blip.ai')); + verify(mockWebSocketTransport.send(any)).called(1); + }); + }); + + group('sendFinishingSession', () { + test('should return a exception if state is not established', () { + clientChannel.state = SessionState.isNew; + + expect(clientChannel.sendFinishingSession(), throwsException); + verifyNever(mockWebSocketTransport.send(any)); + }); + test('should called the send at transport if session state is established', + () { + clientChannel.state = SessionState.established; + + clientChannel.sendFinishingSession(); + verify(mockWebSocketTransport.send(any)).called(1); + }); + }); +} diff --git a/test/protocol/client/client_channel_test.mocks.dart b/test/protocol/client/client_channel_test.mocks.dart new file mode 100644 index 0000000..d85afe3 --- /dev/null +++ b/test/protocol/client/client_channel_test.mocks.dart @@ -0,0 +1,88 @@ +// Mocks generated by Mockito 5.1.0 from annotations +// in lime/test/protocol/client/client_channel_test.dart. +// Do not manually edit this file. + +import 'dart:async' as _i2; +import 'dart:io' as _i5; + +import 'package:lime/src/protocol/enums/session_compression.enum.dart' as _i6; +import 'package:lime/src/protocol/enums/session_encryption.enum.dart' as _i7; +import 'package:lime/src/protocol/envelope.dart' as _i8; +import 'package:lime/src/protocol/network/web_socket_transport.dart' as _i4; +import 'package:mockito/mockito.dart' as _i1; +import 'package:simple_logger/simple_logger.dart' as _i3; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types + +class _FakeStreamController_0 extends _i1.Fake + implements _i2.StreamController {} + +class _FakeSimpleLogger_1 extends _i1.Fake implements _i3.SimpleLogger {} + +/// A class which mocks [WebSocketTransport]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockWebSocketTransport extends _i1.Mock + implements _i4.WebSocketTransport { + @override + set stream(_i2.StreamController>? _stream) => + super.noSuchMethod(Invocation.setter(#stream, _stream), + returnValueForMissingStub: null); + @override + set socket(_i5.WebSocket? _socket) => + super.noSuchMethod(Invocation.setter(#socket, _socket), + returnValueForMissingStub: null); + @override + set sessionId(String? _sessionId) => + super.noSuchMethod(Invocation.setter(#sessionId, _sessionId), + returnValueForMissingStub: null); + @override + _i2.StreamController get onClose => + (super.noSuchMethod(Invocation.getter(#onClose), + returnValue: _FakeStreamController_0()) + as _i2.StreamController); + @override + set onClose(_i2.StreamController? _onClose) => + super.noSuchMethod(Invocation.setter(#onClose, _onClose), + returnValueForMissingStub: null); + @override + _i3.SimpleLogger get logger => (super.noSuchMethod(Invocation.getter(#logger), + returnValue: _FakeSimpleLogger_1()) as _i3.SimpleLogger); + @override + set compression(_i6.SessionCompression? _compression) => + super.noSuchMethod(Invocation.setter(#compression, _compression), + returnValueForMissingStub: null); + @override + set encryption(_i7.SessionEncryption? _encryption) => + super.noSuchMethod(Invocation.setter(#encryption, _encryption), + returnValueForMissingStub: null); + @override + set onEvelope(_i2.StreamController>? _onEvelope) => + super.noSuchMethod(Invocation.setter(#onEvelope, _onEvelope), + returnValueForMissingStub: null); + @override + _i2.Future open(String? uri) => + (super.noSuchMethod(Invocation.method(#open, [uri]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i2.Future); + @override + _i2.Future close() => (super.noSuchMethod(Invocation.method(#close, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i2.Future); + @override + void send(_i8.Envelope? envelope) => + super.noSuchMethod(Invocation.method(#send, [envelope]), + returnValueForMissingStub: null); + @override + void ensureSocketOpen() => + super.noSuchMethod(Invocation.method(#ensureSocketOpen, []), + returnValueForMissingStub: null); +} diff --git a/test/protocol/command_test.dart b/test/protocol/command_test.dart new file mode 100644 index 0000000..d5ca4c4 --- /dev/null +++ b/test/protocol/command_test.dart @@ -0,0 +1,60 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:lime/lime.dart'; +import 'dart:convert'; +import 'dart:io'; + +void main() { + const String jsonPath = "test_resources/command.json"; + Map json = {}; + + setUp(() async { + final file = File(jsonPath); + json = jsonDecode(await file.readAsString()); + }); + + group('Command.fromJson', () { + test('should returns a Command object from a json document', () async { + final command = Command.fromJson(json); + + expect(command, isA()); + }); + test('should set the Command properties ', () async { + final command = Command.fromJson(json); + + expect(command.metadata, equals(json['metadata'])); + expect(describeEnum(command.method!), equals(json['method'])); + expect(command.resource, equals(json['resource'])); + expect(describeEnum(command.status!), equals(json['status'])); + expect(command.type, equals(json['type'])); + expect(command.uri, equals(json['uri'])); + expect( + command.reason!.description, equals(json['reason']['description'])); + expect(command.reason!.code, equals(json['reason']['code'])); + }); + }); + + group('Command.toJson', () { + test('should returns a Json object from a Command object', () async { + final command = Command.fromJson(json); + final jsonDoc = command.toJson(); + + expect(jsonDoc, isA()); + }); + test('should set the json properties ', () async { + final command = Command.fromJson(json); + final jsonDoc = command.toJson(); + + expect(jsonDoc['metadata'], equals(command.metadata)); + expect(jsonDoc['method'], equals(describeEnum(command.method!))); + expect(jsonDoc['resource'], equals(command.resource)); + expect(jsonDoc['status'], equals(describeEnum(command.status!))); + expect(jsonDoc['type'], equals(command.type)); + expect(jsonDoc['uri'], equals(command.uri)); + expect(jsonDoc['reason']['description'], + equals(command.reason!.description)); + expect(jsonDoc['reason']['code'], equals(command.reason!.code)); + }); + }); +} diff --git a/test/protocol/envelope_test.dart b/test/protocol/envelope_test.dart new file mode 100644 index 0000000..55618d0 --- /dev/null +++ b/test/protocol/envelope_test.dart @@ -0,0 +1,30 @@ +import 'package:flutter_test/flutter_test.dart'; + +import 'package:lime/lime.dart'; +import 'dart:convert'; +import 'dart:io'; + +void main() async { + const String jsonPath = "test_resources/envelope.json"; + Map json = {}; + + final file = File(jsonPath); + json = jsonDecode(await file.readAsString()); + + group('Envelope.fromJson', () { + test('should returns a Envelope object from a json document', () async { + final envelope = Envelope.fromJson(json); + + expect(envelope, isA()); + }); + test('should set the Envelope properties ', () async { + final envelope = Envelope.fromJson(json); + + expect(envelope.id, equals(json['id'])); + expect(envelope.to.toString(), equals(json['to'])); + expect(envelope.from.toString(), equals(json['from'])); + expect(envelope.pp.toString(), equals(json['pp'])); + expect(envelope.metadata, equals(json['metadata'])); + }); + }); +} diff --git a/test/protocol/message_test.dart b/test/protocol/message_test.dart new file mode 100644 index 0000000..146aebc --- /dev/null +++ b/test/protocol/message_test.dart @@ -0,0 +1,43 @@ +import 'package:flutter_test/flutter_test.dart'; + +import 'package:lime/lime.dart'; +import 'dart:convert'; +import 'dart:io'; + +void main() async { + const String jsonPath = "test_resources/message.json"; + Map json = {}; + + final file = File(jsonPath); + json = jsonDecode(await file.readAsString()); + + group('Message.fromJson', () { + test('should returns a Message object from a json document', () async { + final message = Message.fromJson(json); + + expect(message, isA()); + }); + test('should set the Message properties ', () async { + final message = Message.fromJson(json); + + expect(message.type, equals(json['type'])); + expect(message.content, equals(json['content'])); + }); + }); + + group('Message.toJson', () { + test('should returns a Json object from a Message object', () async { + final message = Message.fromJson(json); + final jsonDoc = message.toJson(); + + expect(jsonDoc, isA()); + }); + test('should set the json properties ', () async { + final message = Message.fromJson(json); + final jsonDoc = message.toJson(); + + expect(jsonDoc['type'], equals(message.type)); + expect(jsonDoc['content'], equals(message.content)); + }); + }); +} diff --git a/test/protocol/notification_test.dart b/test/protocol/notification_test.dart new file mode 100644 index 0000000..383de32 --- /dev/null +++ b/test/protocol/notification_test.dart @@ -0,0 +1,48 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:lime/lime.dart'; +import 'dart:convert'; +import 'dart:io'; + +void main() async { + const String jsonPath = "test_resources/notification.json"; + Map json = {}; + + final file = File(jsonPath); + json = jsonDecode(await file.readAsString()); + + group('Notification.fromJson', () { + test('should returns a Notification object from a json document', () async { + final notification = Notification.fromJson(json); + + expect(notification, isA()); + }); + test('should set the Notification properties ', () async { + final notification = Notification.fromJson(json); + + expect(describeEnum(notification.event!), equals(json['event'])); + expect(notification.reason!.description, + equals(json['reason']['description'])); + expect(notification.reason!.code, equals(json['reason']['code'])); + }); + }); + + group('Notification.toJson', () { + test('should returns a Json object from a Notification object', () async { + final notification = Notification.fromJson(json); + final jsonDoc = notification.toJson(); + + expect(jsonDoc, isA()); + }); + test('should set the json properties ', () async { + final notification = Notification.fromJson(json); + final jsonDoc = notification.toJson(); + + expect(jsonDoc['event'], equals(describeEnum(notification.event!))); + expect(jsonDoc['reason']['description'], + equals(notification.reason!.description)); + expect(jsonDoc['reason']['code'], equals(notification.reason!.code)); + }); + }); +} diff --git a/test/protocol/reason_test.dart b/test/protocol/reason_test.dart new file mode 100644 index 0000000..09448eb --- /dev/null +++ b/test/protocol/reason_test.dart @@ -0,0 +1,51 @@ +import 'package:flutter_test/flutter_test.dart'; + +import 'package:lime/lime.dart'; +import 'dart:convert'; +import 'dart:io'; + +void main() async { + const String jsonPath = "test_resources/reason.json"; + Map json = {}; + + final file = File(jsonPath); + json = jsonDecode(await file.readAsString()); + + group('Reason.fromJson', () { + test('should returns a Reason object from a json document', () async { + final reason = Reason.fromJson(json); + + expect(reason, isA()); + }); + test('should set the Reason properties ', () async { + final reason = Reason.fromJson(json); + + expect(reason.code, equals(json['code'])); + expect(reason.description, equals(json['description'])); + }); + }); + + group('Reason.toJson', () { + test('should returns a Json object from a Reason object', () async { + final reason = Reason.fromJson(json); + final jsonDoc = reason.toJson(); + + expect(jsonDoc, isA()); + }); + test('should set the json properties ', () async { + final reason = Reason.fromJson(json); + final jsonDoc = reason.toJson(); + + expect(jsonDoc['code'], equals(reason.code)); + expect(jsonDoc['description'], equals(reason.description)); + }); + }); + + group('toString()', () { + test("should returns 'description (Code code)'", () { + final reason = Reason(code: 0, description: 'timeout'); + + expect(reason.toString(), equals('timeout (Code 0)')); + }); + }); +} diff --git a/test/protocol/session_test.dart b/test/protocol/session_test.dart new file mode 100644 index 0000000..ecd5b85 --- /dev/null +++ b/test/protocol/session_test.dart @@ -0,0 +1,41 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:lime/lime.dart'; +import 'dart:convert'; +import 'dart:io'; + +void main() async { + const String jsonPath = "test_resources/session.json"; + Map json = {}; + + final file = File(jsonPath); + json = jsonDecode(await file.readAsString()); + + group('Session.fromJson', () { + test('should returns a Session object from a json document', () async { + final session = Session.fromJson(json); + + expect(session, isA()); + }); + test('should set the Session properties ', () async { + final session = Session.fromJson(json); + + expect(describeEnum(session.state!), equals(json['state'])); + expect( + session.reason!.description, equals(json['reason']['description'])); + expect(session.reason!.code, equals(json['reason']['code'])); + expect((session.schemeOptions!.length), + equals(json['schemeOptions'].length)); + }); + }); + + group('Session.toJson', () { + test('should returns a Json object from a Session object', () async { + final session = Session.fromJson(json); + final jsonDoc = session.toJson(); + + expect(jsonDoc, isA()); + }); + }); +} diff --git a/test_resources/command.json b/test_resources/command.json new file mode 100644 index 0000000..87ed98a --- /dev/null +++ b/test_resources/command.json @@ -0,0 +1,12 @@ +{ + "from": "postmaster@desk.msging.net/!hmg-az-iris2", + "id": "78bf09f7-39ae-46bb-a293-3f66d3464ce0", + "metadata": {"server.shouldStore": "True", "#command.uri": "lime://andre.rossi%40take.net@blip.ai/tickets/active"}, + "method": "get", + "resource": {"total": 8, "itemType": "application/vnd.iris.ticket+json", "items": []}, + "status": "success", + "to": "andre.rossi%40take.net@blip.ai/!desk", + "type": "application/vnd.lime.collection+json", + "uri": "/ping", + "reason": {"code": 0, "description": "Timeout"} +} \ No newline at end of file diff --git a/test_resources/envelope.json b/test_resources/envelope.json new file mode 100644 index 0000000..d2582b9 --- /dev/null +++ b/test_resources/envelope.json @@ -0,0 +1,7 @@ +{ + "id": "78bf09f7-39ae-46bb-a293-3f66d3464ce0", + "to": "postmaster@desk.msging.net", + "from": "postmaster@desk.msging.net", + "pp": "postmaster@desk.msging.net", + "metadata": {"server.shouldStore": "true"} +} \ No newline at end of file diff --git a/test_resources/message.json b/test_resources/message.json new file mode 100644 index 0000000..151da5e --- /dev/null +++ b/test_resources/message.json @@ -0,0 +1,6 @@ +{ + "id": "78bf09f7-39ae-46bb-a293-3f66d3464ce0", + "to": "bfba9ce2-e461-4b42-9ba1-01806751fde1@desk.msging.net/Lime", + "type": "text/plain", + "content": "oi" +} \ No newline at end of file diff --git a/test_resources/notification.json b/test_resources/notification.json new file mode 100644 index 0000000..1367154 --- /dev/null +++ b/test_resources/notification.json @@ -0,0 +1,7 @@ +{ + "id": "78bf09f7-39ae-46bb-a293-3f66d3464ce0", + "from": "postmaster@blip.ai/#hmg-az-iris2", + "to": "andre.rossi%40take.net@blip.ai/!desk", + "event": "failed", + "reason": {"code": 0, "description": "Timeout"} +} \ No newline at end of file diff --git a/test_resources/reason.json b/test_resources/reason.json new file mode 100644 index 0000000..e9a1041 --- /dev/null +++ b/test_resources/reason.json @@ -0,0 +1,4 @@ +{ + "code": 0, + "description": "Timeout" +} \ No newline at end of file diff --git a/test_resources/session.json b/test_resources/session.json new file mode 100644 index 0000000..0edafa2 --- /dev/null +++ b/test_resources/session.json @@ -0,0 +1,13 @@ +{ + "authentication": { + "issuer": "account.blip.ai", + "scheme": "external", + "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjRlY2RmZmViNjJlYjA0ZW.." + }, + "from": "andre.rossi%40take.net@blip.ai/!desk", + "id": "571c06ca-dfed-4101-9e97-0d0b9ccf8d24", + "scheme": "external", + "state": "authenticating", + "schemeOptions": ["guest", "plain", "transport", "key", "external"], + "reason": {"code": 0, "description": "Timeout"} +} \ No newline at end of file