diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2014-05-31 18:19:56 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2014-05-31 18:29:35 +0200 |
commit | f639318faf742dfecb236c56239ffebe50621a97 (patch) | |
tree | e8edcb80124a4283c024cb2192013b32bfddfa9d /tests | |
parent | 1e7f861fb5f742fe27a7efd1f5b90f32b00c3ce3 (diff) |
Merge test_minimal into test_misc
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_minimal.doctest | 51 | ||||
-rw-r--r-- | tests/test_misc.doctest | 30 |
2 files changed, 30 insertions, 51 deletions
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') |