From cadc6d94c8875ebaf8f1d4c400d788a059d76416 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 19 Mar 2016 20:02:49 +0100 Subject: Improve tests and test coverage This adds tests to ensure that incorrect attribute and value types in the PSKC file raise a ValueError exception and extends the tests for invalid encryption options. This removes some code or adds no cover directives to a few places that have unreachable code or are Python version specific and places doctest directives inside the doctests where needed. --- tests/test_rfc6030.doctest | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests/test_rfc6030.doctest') diff --git a/tests/test_rfc6030.doctest b/tests/test_rfc6030.doctest index 98b276d..634e1c7 100644 --- a/tests/test_rfc6030.doctest +++ b/tests/test_rfc6030.doctest @@ -1,6 +1,6 @@ test_rfc6030.doctest - test for examples from RFC 6030 -Copyright (C) 2014-2015 Arthur de Jong +Copyright (C) 2014-2016 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -155,7 +155,7 @@ encryption. >>> key = pskc.keys[0] >>> key.id '12345678' ->>> key.secret +>>> key.secret # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... DecryptionError: No key available @@ -168,6 +168,12 @@ DecryptionError: No key available '3132333435363738393031323334353637383930' >>> key.check() True +>>> key.algorithm +'urn:ietf:params:xml:ns:keyprov:pskc:hotp' +>>> key.response_length +8 +>>> key.manufacturer +'Manufacturer' This tests a derived master key using PBKDF2 as seen in Figure 7 from RFC @@ -186,6 +192,12 @@ This tests a derived master key using PBKDF2 as seen in Figure 7 from RFC '12345678901234567890' >>> key.check() True +>>> key.algorithm +'urn:ietf:params:xml:ns:keyprov:pskc:hotp' +>>> key.response_length +8 +>>> key.manufacturer +'TokenVendorAcme' This tests bulk provisioning as shown in Figure 10 From RFC 6030. -- cgit v1.2.3