Add test for USB version string
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 2 Aug 2012 08:44:08 +0000 (17:44 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 2 Aug 2012 08:44:08 +0000 (17:44 +0900)
test/features/991_version_string.feature [new file with mode: 0644]
test/features/steps.py
test/gnuk.py

diff --git a/test/features/991_version_string.feature b/test/features/991_version_string.feature
new file mode 100644 (file)
index 0000000..9a10d4c
--- /dev/null
@@ -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]+
index d995ccf..70e3046 100644 (file)
@@ -108,6 +108,9 @@ def encrypt_on_host_public_key():
 def decrypt():
     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]+)")
 def get_data(name, tag_str):
index a334678..13a9320 100644 (file)
@@ -77,6 +77,9 @@ class gnuk_token(object):
         self.__timeout = 10000
         self.__seq = 0
 
+    def get_string(self, num):
+        return self.__devhandle.getString(num, 512)
+
     def increment_seq(self):
         self.__seq = (self.__seq + 1) & 0xff