aboutsummaryrefslogtreecommitdiff
path: root/unittest
Commit message (Collapse)AuthorAge
* Add test for NK_list_devices to test_multiple_deviceswip/multiple-devicesRobin Krahl2019-01-13
| | | | | As we cannot test this function properly in Python (due to missing struct definitions), we test it in the C++ test suite.
* Add test for NK_connect_with_pathRobin Krahl2019-01-13
| | | | | As we cannot read the output of NK_list_devices in the Python tests at the moment, this test case uses NK_list_devices_by_cpuID instead.
* Add simple test for NK_list_devicesRobin Krahl2019-01-13
| | | | | | | Unfortunately, I cannot test more as the current ffi implementation does not allow me to import struct definitions. Without the definition for the NK_device_info struct, I cannot inspect the result of the NK_list_devices function.
* Change std::wstring to std::string in DeviceInfoRobin Krahl2019-01-13
| | | | | | | For easier handling, we should use a std::string instead of std::wstring for the serial number in DeviceInfo. For the conversion, I assume that the serial number is valid UTF-8. As it should be alphanumeric and ASCII only, this should be true.
* Add test case for NitrokeyManager::connect_with_path to test_multiple_devicesRobin Krahl2019-01-13
| | | | | | The current test case is renamed to “Use Storage API” as it queries the storage status. The new test case, “Use API”, lists all connected devices and prints their model, path and serial number.
* Add test case for Device::enumerate to test_multiple_devicesRobin Krahl2019-01-13
| | | | | | The current test case is renamed to “List Storage devices” as it also displays the SD card ID. The new test case, “List devices”, lists all connected devices and prints their model, path and serial number.
* Make Device::enumerate staticRobin Krahl2019-01-13
| | | | | | | | | | | 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.
* Change Nitrokey::list_devices return type to use DeviceInfoRobin Krahl2019-01-13
| | | | | | In the previous commit, we changed the return value of Device::enumerate to std::vector<DeviceInfo>. Now we change Nitrokey::list_devices to also return DeviceInfo instances.
* Change Device::enumerate return type to use DeviceInfoRobin Krahl2019-01-13
| | | | | | The return type of Device::enumerate is changed from std::vector<std::string> to std::vector<DeviceInfo> to expose the additional information contained in the DeviceInfo struct.
* Mention potential test failure cause, when no git version is providedSzczepan Zalega2019-01-02
| | | | | | Related to #133 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add safe to user data C++ tests - test_safe.cppSzczepan Zalega2019-01-02
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Run enabling firmware update mode, but with wrong password onlySzczepan Zalega2018-11-22
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Handle UNKNOWN_ERROR return codeSzczepan Zalega2018-11-22
| | | | | | | | Handle UNKNOWN_ERROR code (introduced in Storage v0.51, firmware commit 687d4aca31ce405db41231be73864ee2f91b3714) and is returned, when device fails to retrieve the AES key. Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Update for compatibility with Catch2 version 2.3.0Tom Hughes2018-07-24
|
* Update Catch to version 2.3.0Tom Hughes2018-07-24
|
* meson: improve generation of vcs_tagIgor Gnatenko2018-07-18
| | | | Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Allow for <patch> field in library version getter testSzczepan Zalega2018-07-18
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'pr_116'Szczepan Zalega2018-07-07
|\ | | | | | | | | | | Allow to connect to device with model specified by enum. Fixes #116
| * Replace *out function parameter with return valueSzczepan Zalega2018-06-20
| | | | | | | | | | | | | | Using return value instead of memory manipulation seem to be cleaner solution and less error prone due to avoiding pointer usage. Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Expose device model in C APIRobin Krahl2018-05-25
| | | | | | | | | | | | | | | | | | The C++ API already provides access to the model of the connected device in NitrokeyManager::get_connected_device_model(). This patch also exposes this information in the C API by adding NK_get_device_model. As there might be no device connected, the function returns a boolean indicating the connection status and writes the model of the connected device to a pointer passed as an argument.
* | Add a test to ensure valid C code in the C APIRobin Krahl2018-07-05
| | | | | | | | | | | | | | | | | | | | All current tests are written in C++. Therefore C++-only code in the C API might not be detected by the tests. This patch adds a minimal test written in C that only includes the C API header. This should make sure that the C API code is valid. The new test is called `test_minimal.c` and is added to the CMake COMPILE_OFFLINE_TESTS option.
* | Merge branch 'pr_123'Szczepan Zalega2018-06-22
|\ \ | | | | | | | | | | | | | | | Fix version getter test Closes #123
| * | Fix unit test for get_library_version for release commitsRobin Krahl2018-06-21
| | | | | | | | | | | | | | | | | | | | | `git describe` may return a tag name or <tag>-<n>-g<hash>, where <n> is the number of commits since the last tag <tag> and <hash> is the hash of the current commit. The current test case only considers the latter case. This patch adds a regular expression to handle both cases.
* | | Merge branch 'pr_115'Szczepan Zalega2018-06-20
|\ \ \ | |/ / |/| | | | | | | | | | | Fix connect() return value in offline mode Fixes #115
| * | Add extended test for the connect() return value in offline modeSzczepan Zalega2018-06-20
| | | | | | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | | Add offline test for version getterSzczepan Zalega2018-06-19
| | | | | | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | | Skip test for devices with firmware lower than v0.9Szczepan Zalega2018-05-24
| | | | | | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | | Add authorization testsSzczepan Zalega2018-05-21
|/ / | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* / Fix include path for NK_C_API.h in test_strdup.cppRobin Krahl2018-05-19
|/
* Implement suggested testsSzczepan Zalega2018-04-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Fix compilation warnings for testsSzczepan Zalega2018-04-19
| | | | | | | Cleanup CMakeList a bit as well. Fixes #97 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Tests: skip reading custom-type based function headerSzczepan Zalega2018-04-10
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Null-terminate the argument for strtoulRobin Krahl2018-04-10
| | | | | | As discussed in issue #95, the buffer passed to strtoul must be null-terminated. This patch null-terminates the buffer used in hexStringToByte in the test_HOTP unit test to avoid a buffer over-read.
* Add missing licensesSzczepan Zalega2018-03-13
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct firmware version getting in Pro testsSzczepan Zalega2018-03-02
| | | | | | Done for Pro devices Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add test's scenario descriptionsSzczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Python test running commands on all connected devicesSzczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add tests for refreshed devices list and not refreshed in the loopSzczepan Zalega2018-02-28
| | | | | | Add it to CMake Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* List devices by unique SC:SD idSzczepan Zalega2018-02-28
| | | | | | | Add C API and tests Add mutexes Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Initial support for multiple devices with C++ and testSzczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Tests: make sure encrypted volume is enabled before unlocking hidden volumeSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Tests: rename _admin related and skip not supported encrypted volume ro/rw testsSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do not run C_API tests if not connectedSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Allow to call CFFI loading function from Python consoleSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add tests for Encrypted volume ro/rw switchSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Tests: set debug level from environment variable, show connected device ↵Szczepan Zalega2018-02-23
| | | | | | model and version Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Tests for unencrypted volume switching with Admin PINSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct getting minor and major from firmware versionSzczepan Zalega2018-02-23
| | | | | | | | | Add get_minor_firmware_version Correct get_major_firmware version (was returning minor instead) Name 3rd version field for test builds Use minor firmware version in tests Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add test for enabling firmware updateSzczepan Zalega2018-02-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Fix bug with different data readSzczepan Zalega2018-01-29
| | | | | | Makes occasional fails Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>