Add test for USB version string
This commit is contained in:
8
test/features/991_version_string.feature
Normal file
8
test/features/991_version_string.feature
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
@usb
|
||||||
|
Feature: examine USB version string
|
||||||
|
In order to work as Gnuk Token
|
||||||
|
A token should support version string
|
||||||
|
|
||||||
|
Scenario: USB version string
|
||||||
|
Given USB version string of the token
|
||||||
|
Then data should match: ([a-zA-Z0-9]*)-([.0-9]+)-[0-9A-F]+
|
||||||
@@ -108,6 +108,9 @@ def encrypt_on_host_public_key():
|
|||||||
def decrypt():
|
def decrypt():
|
||||||
scc.result = ftc.token.cmd_pso_longdata(0x80, 0x86, scc.ciphertext)
|
scc.result = ftc.token.cmd_pso_longdata(0x80, 0x86, scc.ciphertext)
|
||||||
|
|
||||||
|
@Given("USB version string of the token")
|
||||||
|
def usb_version_string():
|
||||||
|
scc.result = ftc.token.get_string(3)
|
||||||
|
|
||||||
@When("requesting (.+): ([0-9a-fA-F]+)")
|
@When("requesting (.+): ([0-9a-fA-F]+)")
|
||||||
def get_data(name, tag_str):
|
def get_data(name, tag_str):
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ class gnuk_token(object):
|
|||||||
self.__timeout = 10000
|
self.__timeout = 10000
|
||||||
self.__seq = 0
|
self.__seq = 0
|
||||||
|
|
||||||
|
def get_string(self, num):
|
||||||
|
return self.__devhandle.getString(num, 512)
|
||||||
|
|
||||||
def increment_seq(self):
|
def increment_seq(self):
|
||||||
self.__seq = (self.__seq + 1) & 0xff
|
self.__seq = (self.__seq + 1) & 0xff
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user