[Pcsclite-cvs-commit] r5345 - /trunk/PCSC/UnitaryTests/SCardCancel2.py
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Fri Oct 22 12:53:08 UTC 2010
Author: rousseau
Date: Fri Oct 22 12:53:07 2010
New Revision: 5345
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5345
Log:
SCardCancel() should do nothing if no cancellable call is ongoing
bug fixed in revision 5344
Added:
trunk/PCSC/UnitaryTests/SCardCancel2.py (with props)
Added: trunk/PCSC/UnitaryTests/SCardCancel2.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/UnitaryTests/SCardCancel2.py?rev=5345&op=file
==============================================================================
--- trunk/PCSC/UnitaryTests/SCardCancel2.py (added)
+++ trunk/PCSC/UnitaryTests/SCardCancel2.py Fri Oct 22 12:53:07 2010
@@ -1,0 +1,48 @@
+#! /usr/bin/env python
+
+# SCardCancel2.py : Unitary test for SCardCancel()
+# Copyright (C) 2010 Jan Rochat
+# https://bugs.launchpad.net/ubuntu/+source/pcsc-lite/+bug/647545/comments/6
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# SCardCancel() should do nothing if no cancellable call is ongoing
+# bug fixed in revision 5344
+
+from smartcard.scard import *
+
+try:
+ hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
+ if hresult != SCARD_S_SUCCESS:
+ raise Exception('Failed to establish context : ' +
+ SCardGetErrorMessage(hresult))
+ print 'Context established!'
+
+ try:
+ hresult = SCardCancel(hcontext)
+ if hresult != SCARD_S_SUCCESS:
+ raise Exception('Failed to cancel context : ' +
+ SCardGetErrorMessage(hresult))
+ print 'context canceled'
+
+ finally:
+ hresult = SCardReleaseContext(hcontext)
+ if hresult != SCARD_S_SUCCESS:
+ raise Exception('Failed to release context: ' +
+ SCardGetErrorMessage(hresult))
+ print 'Released context.'
+
+except Exception, message:
+ print "Exception:", message
Propchange: trunk/PCSC/UnitaryTests/SCardCancel2.py
------------------------------------------------------------------------------
svn:executable = *
More information about the Pcsclite-cvs-commit
mailing list