famedlysdk/test/fake_client.dart

46 lines
2 KiB
Dart
Raw Normal View History

2020-06-05 07:59:37 +00:00
/*
* Ansible inventory script used at Famedly GmbH for managing many hosts
* Copyright (C) 2020 Famedly GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import 'package:famedlysdk/famedlysdk.dart';
import 'fake_matrix_api.dart';
import 'fake_database.dart';
2020-06-13 08:56:39 +00:00
const SSSS_PASSPHRASE = 'nae7ahDiequ7ohniufah3ieS2je1thohX4xeeka7aixohsho9O';
const SSSS_KEY = 'EsT9 RzbW VhPW yqNp cC7j ViiW 5TZB LuY4 ryyv 9guN Ysmr WDPH';
2020-06-05 07:59:37 +00:00
// key @test:fakeServer.notExisting
const pickledOlmAccount =
2020-06-05 08:15:36 +00:00
'N2v1MkIFGcl0mQpo2OCwSopxPQJ0wnl7oe7PKiT4141AijfdTIhRu+ceXzXKy3Kr00nLqXtRv7kid6hU4a+V0rfJWLL0Y51+3Rp/ORDVnQy+SSeo6Fn4FHcXrxifJEJ0djla5u98fBcJ8BSkhIDmtXRPi5/oJAvpiYn+8zMjFHobOeZUAxYR0VfQ9JzSYBsSovoQ7uFkNks1M4EDUvHtuyg3RxViwdNxs3718fyAqQ/VSwbXsY0Nl+qQbF+nlVGHenGqk5SuNl1P6e1PzZxcR0IfXA94Xij1Ob5gDv5YH4UCn9wRMG0abZsQP0YzpDM0FLaHSCyo9i5JD/vMlhH+nZWrgAzPPCTNGYewNV8/h3c+VyJh8ZTx/fVi6Yq46Fv+27Ga2ETRZ3Qn+Oyx6dLBjnBZ9iUvIhqpe2XqaGA1PopOz8iDnaZitw';
2020-06-05 07:59:37 +00:00
Future<Client> getClient() async {
2020-08-06 06:55:35 +00:00
final client = Client('testclient', httpClient: FakeMatrixApi());
2020-06-05 07:59:37 +00:00
client.database = getDatabase();
await client.checkServer('https://fakeServer.notExisting');
client.connect(
2020-08-11 16:11:51 +00:00
newToken: 'abcd',
newUserID: '@test:fakeServer.notExisting',
newHomeserver: client.homeserver,
2020-06-05 07:59:37 +00:00
newDeviceName: 'Text Matrix Client',
2020-08-11 16:11:51 +00:00
newDeviceID: 'GHTYAJCE',
2020-06-05 07:59:37 +00:00
newOlmAccount: pickledOlmAccount,
);
await Future.delayed(Duration(milliseconds: 10));
return client;
}