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