diff --git a/.gitmodules b/.gitmodules index 2d451727873e233236b00f020b89ae8acf6bc8ac..778e626b0812674c6b091cc019869531a26f7dd6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "libdap"] path = libdap url = https://github.com/cellframe/libdap.git +[submodule "test/libdap-python"] + path = test/libdap-python + url = https://github.com/cellframe/libdap-python.git diff --git a/test/libdap-python b/test/libdap-python new file mode 160000 index 0000000000000000000000000000000000000000..e8d7f4e84f0cbca515236f317e9aa5d079df1962 --- /dev/null +++ b/test/libdap-python @@ -0,0 +1 @@ +Subproject commit e8d7f4e84f0cbca515236f317e9aa5d079df1962 diff --git a/test/test.py b/test/test.py new file mode 100644 index 0000000000000000000000000000000000000000..0b2c73df18399af813422aa564b6984cdcee3ad0 --- /dev/null +++ b/test/test.py @@ -0,0 +1,21 @@ +import libdap_crypto_python_module as crypto +import unittest + +class TestLibdapCryptoPythonModule(unittest.TestCase): + def test_ini(self): + self.assertTrue(crypto.init() == 0, "Failed init libdap crypto python") + def test_deinit(self): + self.assertTrue(crypto.deinit() == 0, "Failed deinit libdap crypto python") + def test_b58(self): + s = "REvgshguqwt76thuioh1`lwi0-8i-d0hjwpeocnpgh89efty7ug" + crypt = crypto.encode_base58(s) + decrypt = crypto.decode_base58(crypt) + self.assertTrue(s == decrypt, "Encoding and decoded information using the base58 algorithm does not match the original") + def test_b64(self): + s = "LindyfekrngFHJFGR23356fer" + crypt = crypto.encode_base64(s) + decrypt = crypto.decode_base64(crypt, len(s)) + self.assertTrue(s == decrypt, "Encoding and decoded information using the base64 algorithm does not match the original") + +if __name__ == '__main__': + unittest.main()