Make coverage visible again
This commit is contained in:
parent
359e03496a
commit
066221b84d
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -9,6 +9,9 @@
|
|||
.history
|
||||
.svn/
|
||||
native/
|
||||
test/.test_coverage.dart
|
||||
coverage/
|
||||
coverage_badge.svg
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
|
|
|
@ -8,7 +8,6 @@ coverage:
|
|||
- linux
|
||||
stage: coverage
|
||||
image: debian:testing
|
||||
coverage: '/^\s+lines.+: (\d+.\d*%)/'
|
||||
dependencies: []
|
||||
script:
|
||||
- apt update
|
||||
|
@ -24,6 +23,10 @@ coverage:
|
|||
- chmod +x ./test.sh
|
||||
- su -c ./prepare.sh test
|
||||
- su -c ./test.sh test
|
||||
artifacts:
|
||||
paths:
|
||||
- coverage/
|
||||
|
||||
|
||||
coverage_without_olm:
|
||||
tags:
|
||||
|
|
14
pubspec.lock
14
pubspec.lock
|
@ -274,6 +274,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
lcov:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lcov
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.7.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -586,6 +593,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.4"
|
||||
test_coverage:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: test_coverage
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.1"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -29,7 +29,8 @@ dependencies:
|
|||
|
||||
dev_dependencies:
|
||||
test: ^1.0.0
|
||||
test_coverage: ^0.4.1
|
||||
moor_generator: ^3.0.0
|
||||
build_runner: ^1.5.2
|
||||
pedantic: ^1.9.0 # DO NOT UPDATE AS THIS WOULD CAUSE FLUTTER TO FAIL
|
||||
moor_ffi: ^0.5.0
|
||||
pedantic: ^1.9.0
|
||||
moor_ffi: ^0.5.0
|
2
test.sh
2
test.sh
|
@ -1,2 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
pub run test -p vm
|
||||
pub run test_coverage
|
||||
genhtml -o coverage coverage/lcov.info || true
|
|
@ -682,6 +682,9 @@ void main() {
|
|||
expect(client2.rooms[1].id, client1.rooms[1].id);
|
||||
expect(client2.rooms[1].outboundGroupSession.session_key(), sessionKey);
|
||||
}
|
||||
|
||||
await client1.logout();
|
||||
await client2.logout();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -207,6 +207,8 @@ void main() {
|
|||
final resp2 = await event.sendAgain(txid: '1234');
|
||||
expect(resp1, null);
|
||||
expect(resp2, '42');
|
||||
|
||||
await matrix.dispose(closeDatabase: true);
|
||||
});
|
||||
|
||||
test('requestKey', () async {
|
||||
|
@ -244,6 +246,8 @@ void main() {
|
|||
}, Room(id: '!1234:example.com', client: matrix));
|
||||
|
||||
await event.requestKey();
|
||||
|
||||
await matrix.dispose(closeDatabase: true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,42 +29,42 @@ import 'fake_database.dart';
|
|||
|
||||
void main() {
|
||||
/// All Tests related to device keys
|
||||
group('Room Key Request', () {
|
||||
test('fromJson', () async {
|
||||
var rawJson = <String, dynamic>{
|
||||
'content': {
|
||||
'action': 'request',
|
||||
'body': {
|
||||
'algorithm': 'm.megolm.v1.aes-sha2',
|
||||
'room_id': '!726s6s6q:example.com',
|
||||
'sender_key': 'RF3s+E7RkTQTGF2d8Deol0FkQvgII2aJDf3/Jp5mxVU',
|
||||
'session_id': 'X3lUlvLELLYxeTx4yOVu6UDpasGEVO0Jbu+QFnm0cKQ'
|
||||
},
|
||||
'request_id': '1495474790150.19',
|
||||
'requesting_device_id': 'JLAFKJWSCS'
|
||||
test('fromJson', () async {
|
||||
var rawJson = <String, dynamic>{
|
||||
'content': {
|
||||
'action': 'request',
|
||||
'body': {
|
||||
'algorithm': 'm.megolm.v1.aes-sha2',
|
||||
'room_id': '!726s6s6q:example.com',
|
||||
'sender_key': 'RF3s+E7RkTQTGF2d8Deol0FkQvgII2aJDf3/Jp5mxVU',
|
||||
'session_id': 'X3lUlvLELLYxeTx4yOVu6UDpasGEVO0Jbu+QFnm0cKQ'
|
||||
},
|
||||
'type': 'm.room_key_request',
|
||||
'sender': '@alice:example.com'
|
||||
};
|
||||
var toDeviceEvent = ToDeviceEvent.fromJson(rawJson);
|
||||
expect(toDeviceEvent.content, rawJson['content']);
|
||||
expect(toDeviceEvent.sender, rawJson['sender']);
|
||||
expect(toDeviceEvent.type, rawJson['type']);
|
||||
'request_id': '1495474790150.19',
|
||||
'requesting_device_id': 'JLAFKJWSCS'
|
||||
},
|
||||
'type': 'm.room_key_request',
|
||||
'sender': '@alice:example.com'
|
||||
};
|
||||
var toDeviceEvent = ToDeviceEvent.fromJson(rawJson);
|
||||
expect(toDeviceEvent.content, rawJson['content']);
|
||||
expect(toDeviceEvent.sender, rawJson['sender']);
|
||||
expect(toDeviceEvent.type, rawJson['type']);
|
||||
|
||||
var matrix = Client('testclient', debug: true);
|
||||
matrix.httpClient = FakeMatrixApi();
|
||||
matrix.database = getDatabase();
|
||||
await matrix.checkServer('https://fakeServer.notExisting');
|
||||
await matrix.login('test', '1234');
|
||||
var room = matrix.getRoomById('!726s6s6q:example.com');
|
||||
if (matrix.encryptionEnabled) {
|
||||
await room.createOutboundGroupSession();
|
||||
rawJson['content']['body']['session_id'] = room.inboundGroupSessions.keys.first;
|
||||
var matrix = Client('testclient', debug: true);
|
||||
matrix.httpClient = FakeMatrixApi();
|
||||
matrix.database = getDatabase();
|
||||
await matrix.checkServer('https://fakeServer.notExisting');
|
||||
await matrix.login('test', '1234');
|
||||
var room = matrix.getRoomById('!726s6s6q:example.com');
|
||||
if (matrix.encryptionEnabled) {
|
||||
await room.createOutboundGroupSession();
|
||||
rawJson['content']['body']['session_id'] =
|
||||
room.inboundGroupSessions.keys.first;
|
||||
|
||||
var roomKeyRequest = RoomKeyRequest.fromToDeviceEvent(
|
||||
ToDeviceEvent.fromJson(rawJson), matrix);
|
||||
await roomKeyRequest.forwardKey();
|
||||
}
|
||||
});
|
||||
var roomKeyRequest = RoomKeyRequest.fromToDeviceEvent(
|
||||
ToDeviceEvent.fromJson(rawJson), matrix);
|
||||
await roomKeyRequest.forwardKey();
|
||||
}
|
||||
await matrix.dispose(closeDatabase: true);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ import 'package:famedlysdk/src/event.dart';
|
|||
import 'package:famedlysdk/src/room.dart';
|
||||
import 'package:famedlysdk/src/user.dart';
|
||||
import 'package:famedlysdk/src/utils/matrix_file.dart';
|
||||
import 'package:famedlysdk/src/database/database.dart' show DbRoom, DbRoomState, DbRoomAccountData;
|
||||
import 'package:famedlysdk/src/database/database.dart'
|
||||
show DbRoom, DbRoomState, DbRoomAccountData;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fake_matrix_api.dart';
|
||||
|
@ -397,15 +398,16 @@ void main() {
|
|||
expect(room.outboundGroupSession != null, true);
|
||||
expect(room.outboundGroupSession.session_id().isNotEmpty, true);
|
||||
expect(
|
||||
room.inboundGroupSessions.containsKey(room.outboundGroupSession.session_id()),
|
||||
room.inboundGroupSessions
|
||||
.containsKey(room.outboundGroupSession.session_id()),
|
||||
true);
|
||||
expect(
|
||||
room.inboundGroupSessions[room.outboundGroupSession.session_id()]
|
||||
.content['session_key'],
|
||||
room.outboundGroupSession.session_key());
|
||||
expect(
|
||||
room.inboundGroupSessions[room.outboundGroupSession.session_id()].indexes
|
||||
.length,
|
||||
room.inboundGroupSessions[room.outboundGroupSession.session_id()]
|
||||
.indexes.length,
|
||||
0);
|
||||
});
|
||||
|
||||
|
@ -442,5 +444,9 @@ void main() {
|
|||
expect(decryptedEvent.typeKey, 'm.room.message');
|
||||
expect(decryptedEvent.content, payload);
|
||||
});
|
||||
|
||||
test('logout', () async {
|
||||
await matrix.logout();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue