mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
More checks
This commit is contained in:
parent
53b69d9623
commit
b98f044204
7 changed files with 50 additions and 30 deletions
|
|
@ -5,6 +5,7 @@
|
|||
import "package:test/test.dart";
|
||||
|
||||
import "package:inventree/api.dart";
|
||||
import "package:inventree/helpers.dart";
|
||||
import "package:inventree/user_profile.dart";
|
||||
|
||||
|
||||
|
|
@ -91,12 +92,13 @@ void main() {
|
|||
assert(!result);
|
||||
|
||||
// TODO: Test that the connection attempt above throws an authentication error
|
||||
|
||||
assert(!api.checkConnection());
|
||||
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("Login Success", () async {
|
||||
|
|
@ -107,12 +109,34 @@ void main() {
|
|||
final bool result = await api.connectToServer();
|
||||
|
||||
// Check expected values
|
||||
expect(result, equals(true));
|
||||
expect(api.hasToken, equals(true));
|
||||
assert(result);
|
||||
assert(api.hasToken);
|
||||
expect(api.baseUrl, equals("http://localhost:12345/"));
|
||||
|
||||
expect(api.isConnected(), equals(true));
|
||||
expect(api.isConnecting(), equals(false));
|
||||
assert(api.isConnected());
|
||||
assert(!api.isConnecting());
|
||||
assert(api.checkConnection());
|
||||
});
|
||||
|
||||
test("Version Checks", () async {
|
||||
// Test server version information
|
||||
var api = InvenTreeAPI();
|
||||
|
||||
assert(await api.connectToServer());
|
||||
|
||||
// Check supported functions
|
||||
assert(api.apiVersion >= 50);
|
||||
assert(api.supportsSettings);
|
||||
assert(api.supportsNotifications);
|
||||
assert(api.supportsModernStockTransactions);
|
||||
assert(api.supportsPoReceive);
|
||||
|
||||
// Check available permissions
|
||||
assert(api.checkPermission("part", "change"));
|
||||
assert(api.checkPermission("stocklocation", "delete"));
|
||||
assert(api.checkPermission("part", "weirdpermission"));
|
||||
assert(api.checkPermission("blah", "bloo"));
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue