aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2019-01-13 12:04:22 +0100
committerRobin Krahl <me@robin-krahl.de>2019-01-13 13:26:12 +0100
commit1751759356bd64cc78f8f71543c3edd5cdce8376 (patch)
tree850e2af876151c5ae2df96c31ea15a333002cd6b /unittest
parent6c52c50d59eafa5acc7ae650695f199b7a014841 (diff)
downloadlibnitrokey-1751759356bd64cc78f8f71543c3edd5cdce8376.tar.gz
libnitrokey-1751759356bd64cc78f8f71543c3edd5cdce8376.tar.bz2
Make Device::enumerate static
Device::enumerate does not need any instance data, therefore it is made static. Note that this not only changes the public API by making the method static. We also return all connected Nitrokey devices instead of only Storage devices. The NitrokeyManager method list_devices_by_cpuID is changed to check the device type so that they still only return Storage devices. The list_device method now returns both Storage and Pro devices.
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_multiple_devices.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/unittest/test_multiple_devices.cc b/unittest/test_multiple_devices.cc
index f9e9ad2..183af4f 100644
--- a/unittest/test_multiple_devices.cc
+++ b/unittest/test_multiple_devices.cc
@@ -35,9 +35,11 @@ using namespace nitrokey;
TEST_CASE("List devices", "[BASIC]") {
shared_ptr<Stick20> d = make_shared<Stick20>();
- auto v = d->enumerate();
+ auto v = Device::enumerate();
REQUIRE(v.size() > 0);
for (auto i : v){
+ if (i.m_deviceModel != DeviceModel::STORAGE)
+ continue;
auto a = i.m_path;
std::cout << a;
d->set_path(a);
@@ -54,11 +56,13 @@ TEST_CASE("List devices", "[BASIC]") {
TEST_CASE("Regenerate AES keys", "[BASIC]") {
shared_ptr<Stick20> d = make_shared<Stick20>();
- auto v = d->enumerate();
+ auto v = Device::enumerate();
REQUIRE(v.size() > 0);
std::vector<shared_ptr<Stick20>> devices;
for (auto i : v){
+ if (i.m_deviceModel != DeviceModel::STORAGE)
+ continue;
auto a = i.m_path;
std::cout << a << endl;
d = make_shared<Stick20>();