From f639318faf742dfecb236c56239ffebe50621a97 Mon Sep 17 00:00:00 2001 From: Arthur de Jong <arthur@arthurdejong.org> Date: Sat, 31 May 2014 18:19:56 +0200 Subject: Merge test_minimal into test_misc --- tests/test_minimal.doctest | 51 ---------------------------------------------- tests/test_misc.doctest | 30 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 51 deletions(-) delete mode 100644 tests/test_minimal.doctest (limited to 'tests') diff --git a/tests/test_minimal.doctest b/tests/test_minimal.doctest deleted file mode 100644 index eee45db..0000000 --- a/tests/test_minimal.doctest +++ /dev/null @@ -1,51 +0,0 @@ -test_minimal.doctest - very basic test of pskc module - -Copyright (C) 2014 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 -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA - - ->>> from pskc import PSKC - - -This tests the most minimal valid PSKC file with one empty key. - ->>> import StringIO ->>> minimal_pskc = StringIO.StringIO(''' -... <?xml version="1.0"?> -... <KeyContainer xmlns="urn:ietf:params:xml:ns:keyprov:pskc" Version="1.0"> -... <KeyPackage/> -... </KeyContainer> -... '''.strip()) ->>> pskc = PSKC(minimal_pskc) ->>> [key.id for key in pskc.keys] -[None] - - -Check creation of empty PSKC structure and adding an empty key to the list. - ->>> pskc = PSKC() ->>> key = pskc.add_key(id='123') ->>> key.id -'123' ->>> key.secret is None -True - -Adding a key with unknown attributes raises an error. ->>> key = pskc.add_key(foo='bar') -Traceback (most recent call last): - ... -AttributeError diff --git a/tests/test_misc.doctest b/tests/test_misc.doctest index d0ead4a..f038f2f 100644 --- a/tests/test_misc.doctest +++ b/tests/test_misc.doctest @@ -21,6 +21,36 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >>> from pskc import PSKC +This tests the most minimal valid PSKC file with one empty key. + +>>> import StringIO +>>> minimal_pskc = StringIO.StringIO(''' +... <?xml version="1.0"?> +... <KeyContainer xmlns="urn:ietf:params:xml:ns:keyprov:pskc" Version="1.0"> +... <KeyPackage/> +... </KeyContainer> +... '''.strip()) +>>> pskc = PSKC(minimal_pskc) +>>> [key.id for key in pskc.keys] +[None] + + +Check creation of empty PSKC structure and adding an empty key to the list. + +>>> pskc = PSKC() +>>> key = pskc.add_key(id='123') +>>> key.id +'123' +>>> key.secret is None +True + +Adding a key with unknown attributes raises an error. +>>> key = pskc.add_key(foo='bar') +Traceback (most recent call last): + ... +AttributeError + + Load an PSKC file with an odd namespace. >>> pskc = PSKC('tests/odd-namespace.pskcxml') -- cgit v1.2.3