changeset 587:e2794fc7f3fb pytest2

test added to check the type in util/test_crypto.
author pkumar <contactprashantat@gmail.com>
date Sat, 25 Jun 2011 00:03:57 +0530
parents efc0fcd76f43
children 36c443f4b37f
files MoinMoin/conftest.py MoinMoin/util/_tests/test_crypto.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/conftest.py	Wed Jun 22 00:37:43 2011 +0530
+++ b/MoinMoin/conftest.py	Sat Jun 25 00:03:57 2011 +0530
@@ -95,7 +95,7 @@
                     # this is for the tests of storage module until we use some cleanup mechanism on tests.
                     if hasattr(prev_cls, 'Config') or hasattr(prev_cls, 'create_backend'):
                         deinit_test_app(prev_app, prev_ctx)
-                        print "problem is here"        
+
                     # Initialize the app in following two conditions: 
                     # 1. It is the first test item 
                     # 2. Class of previous function item had its own configuration i.e. hasattr(cls, Config)
--- a/MoinMoin/util/_tests/test_crypto.py	Wed Jun 22 00:37:43 2011 +0530
+++ b/MoinMoin/util/_tests/test_crypto.py	Sat Jun 25 00:03:57 2011 +0530
@@ -21,6 +21,9 @@
         result2 = crypto.random_string(length)
         assert result1 != result2, ('Expected different random strings, but got "%(result1)s" and "%(result2)s"') % locals()
 
+        result_string = crypto.random_string(length)
+        assert isinstance(result_string, str), ('Expected an string value, but got ' + str(type(result_string)))
+
         result = len(crypto.random_string(length))
         expected = length
         assert result == expected, ('Expected length "%(expected)s" but got "%(result)s"') % locals()
@@ -47,5 +50,4 @@
 
 
 coverage_modules = ['MoinMoin.util.crypto']
-pytest.main("-x test_crypto.py")