diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2018-07-07 21:24:14 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-07-07 21:24:14 +0200 |
commit | 430e4b4116ec00c4875170642f8ae04bc3497d88 (patch) | |
tree | d158fe787ecf1b20cd906dda712ecee8f7285a59 /unittest/test_C_API.cpp | |
parent | 4b3b21dfe6958376db3b1fbcadf6e03f53291e4f (diff) | |
parent | 601f43bfa71b479e32a289eaeec75069cbc7c26f (diff) | |
download | libnitrokey-430e4b4116ec00c4875170642f8ae04bc3497d88.tar.gz libnitrokey-430e4b4116ec00c4875170642f8ae04bc3497d88.tar.bz2 |
Merge branch 'pr_116'
Allow to connect to device with model specified by enum.
Fixes #116
Diffstat (limited to 'unittest/test_C_API.cpp')
-rw-r--r-- | unittest/test_C_API.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/unittest/test_C_API.cpp b/unittest/test_C_API.cpp index acfadd2..1964738 100644 --- a/unittest/test_C_API.cpp +++ b/unittest/test_C_API.cpp @@ -84,4 +84,18 @@ TEST_CASE("multiple devices with ID", "[BASIC]") { } free (string); -}
\ No newline at end of file +} + +TEST_CASE("Get device model", "[BASIC]") { + NK_logout(); + NK_device_model model = NK_get_device_model(); + REQUIRE(model == NK_device_model::NK_DISCONNECTED); + + auto success = NK_login_auto() == 1; + REQUIRE(success); + model = NK_get_device_model(); + REQUIRE(model != NK_device_model::NK_DISCONNECTED); + + REQUIRE((model == NK_PRO || model == NK_STORAGE)); + NK_logout(); +} |