From b41cd5d5b872609c63906fd517e5d0577e4f459f Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Wed, 3 Jul 2019 17:54:53 +0300 Subject: [PATCH] add nfc test force flag --- tools/testing/main.py | 10 ++++++++-- tools/testing/tests/tester.py | 11 +++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/testing/main.py b/tools/testing/main.py index 7e105e0..437e938 100644 --- a/tools/testing/main.py +++ b/tools/testing/main.py @@ -19,7 +19,9 @@ from tests import Tester, FIDO2Tests, U2FTests, HIDTests, SoloTests if __name__ == "__main__": if len(sys.argv) < 2: - print("Usage: %s [sim] <[u2f]|[fido2]|[rk]|[hid]|[ping]>") + print("Usage: %s [sim] [nfc] <[u2f]|[fido2]|[rk]|[hid]|[ping]>") + print(" sim - test via UDP simulation backend only") + print(" nfc - test via NFC interface only") sys.exit(0) t = Tester() @@ -31,7 +33,11 @@ if __name__ == "__main__": t.set_sim(True) t.set_user_count(10) - t.find_device() + nfcOnly = False + if "nfc" in sys.argv: + nfcOnly = True + + t.find_device(nfcOnly) if "solo" in sys.argv: SoloTests(t).run() diff --git a/tools/testing/tests/tester.py b/tools/testing/tests/tester.py index 99f26f6..dbc88f9 100644 --- a/tools/testing/tests/tester.py +++ b/tools/testing/tests/tester.py @@ -62,10 +62,13 @@ class Tester: self.ctap1 = tester.ctap1 self.client = tester.client - def find_device(self,): - print("--- HID ---") - print(list(CtapHidDevice.list_devices())) - dev = next(CtapHidDevice.list_devices(), None) + def find_device(self, nfcInterfaceOnly = False): + dev = None + if not nfcInterfaceOnly: + print("--- HID ---") + print(list(CtapHidDevice.list_devices())) + dev = next(CtapHidDevice.list_devices(), None) + if not dev: try: from fido2.pcsc import CtapPcscDevice