mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Refactor audio file player
- Do not play if there is no context available (e.g. unit testing)
This commit is contained in:
parent
e424a3cf7b
commit
f13b04d029
7 changed files with 94 additions and 50 deletions
|
|
@ -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));
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue