2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 18:25:26 +00:00

Refactor audio file player

- Do not play if there is no context available (e.g. unit testing)
This commit is contained in:
Oliver Walters
2022-05-22 08:23:20 +10:00
parent e424a3cf7b
commit f13b04d029
7 changed files with 94 additions and 50 deletions

View File

@ -39,6 +39,30 @@ void main() {
});
test("Login Failure", () async {
// Tests for various types of login failures
var api = InvenTreeAPI();
// Incorrect server address
var profile = await UserProfileDBManager().getSelectedProfile();
assert(profile != null);
if (profile != null) {
profile.server = "http://localhost:5555";
await UserProfileDBManager().updateProfile(profile);
}
bool result = await api.connectToServer();
assert(!result);
// TODO: Test the the right 'error message' is returned
// TODO: Test incorrect login details
});
test("Login Success", () async {
// Test that we can login to the server successfully
var api = InvenTreeAPI();
@ -46,10 +70,13 @@ void main() {
// Attempt to connect
final bool result = await api.connectToServer();
// Check expected values
expect(result, equals(true));
expect(api.hasToken, equals(true));
expect(api.baseUrl, equals("http://localhost:12345/"));
expect(api.isConnected(), equals(true));
expect(api.isConnecting(), equals(false));
});
});
}