python: Add cr.UNKNOWN_CHECKSUM constant.
authorTomas Mlcoch <tmlcoch@redhat.com>
Wed, 12 Jun 2013 13:49:25 +0000 (15:49 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Wed, 12 Jun 2013 13:49:25 +0000 (15:49 +0200)
src/python/__init__.py
src/python/createrepo_cmodule.c
tests/python/tests/test_checksum.py

index 660edba45fc82683e76493ac582490515a32c07b..395254256fef090c9ec3670a0e35af8a5fa7e9e7 100644 (file)
@@ -8,13 +8,15 @@ VERSION_MINOR = _createrepo_c.VERSION_MINOR
 VERSION_PATCH = _createrepo_c.VERSION_PATCH
 VERSION = u"%d.%d.%d" % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
 
-MD5     = _createrepo_c.MD5
-SHA     = _createrepo_c.SHA
-SHA1    = _createrepo_c.SHA1
-SHA224  = _createrepo_c.SHA224
-SHA256  = _createrepo_c.SHA256
-SHA384  = _createrepo_c.SHA384
-SHA512  = _createrepo_c.SHA512
+UNKNOWN_CHECKSUM    = _createrepo_c.CHECKSUM_UNKNOWN
+CHECKSUM_UNKNOWN    = _createrepo_c.CHECKSUM_UNKNOWN
+MD5                 = _createrepo_c.MD5
+SHA                 = _createrepo_c.SHA
+SHA1                = _createrepo_c.SHA1
+SHA224              = _createrepo_c.SHA224
+SHA256              = _createrepo_c.SHA256
+SHA384              = _createrepo_c.SHA384
+SHA512              = _createrepo_c.SHA512
 
 AUTO_DETECT_COMPRESSION = _createrepo_c.AUTO_DETECT_COMPRESSION
 UNKNOWN_COMPRESSION     = _createrepo_c.UNKNOWN_COMPRESSION
index a41fae79338f17bff9534362daf0beac0ed9a0dc..8b057792b2f05266cf9323f8c5e217fb07ed0412 100644 (file)
@@ -144,6 +144,7 @@ init_createrepo_c(void)
     PyModule_AddIntConstant(m, "VERSION_PATCH", CR_VERSION_PATCH);
 
     /* Checksum types */
+    PyModule_AddIntConstant(m, "CHECKSUM_UNKNOWN", CR_CHECKSUM_UNKNOWN);
     PyModule_AddIntConstant(m, "MD5", CR_CHECKSUM_MD5);
     PyModule_AddIntConstant(m, "SHA", CR_CHECKSUM_SHA);
     PyModule_AddIntConstant(m, "SHA1", CR_CHECKSUM_SHA1);
index f1fc669031bc085a17a313221e43e2b598e78cad..10292f0e56b9e9df033348faf3ef3198c77663fe 100644 (file)
@@ -33,3 +33,5 @@ class TestCaseChecksum(unittest.TestCase):
         self.assertEqual(cr.checksum_type("sha384"), cr.SHA384)
         self.assertEqual(cr.checksum_type("sha512"), cr.SHA512)
 
+        self.assertEqual(cr.checksum_type("foobar"), cr.UNKNOWN_CHECKSUM)
+