From c3e6d6b54741cfbc828272ace576339ae3a37173 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Wed, 17 Dec 2014 21:43:57 +0530 Subject: geo-rep: Unit tests infrastructure for geo-replication Added sample unit test file, $GLUSTER_SRC/geo-replication/tests/unit/test_syncdutils.py Install unittest dependencies, (tox https://tox.readthedocs.org/en/latest/, nose https://nose.readthedocs.org/en/latest/) sudo pip install --upgrade tox nose To run pep8 coding standards tests, cd $GLUSTER_SRC/geo-replication tox -e pep8 To run unit tests, cd $GLUSTER_SRC/geo-replication tox -e py27 py27 is for with Python 2.7+, or py26 for systems with Python 2.6+ Change-Id: Ibdefe2c9d73afda9a7fa1c0db5b126f592b7cb40 BUG: 1177722 Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/9290 Tested-by: Gluster Build System Reviewed-by: Prashanth Pai Reviewed-by: Vijay Bellur --- geo-replication/tests/__init__.py | 10 +++++++++ geo-replication/tests/unit/__init__.py | 10 +++++++++ geo-replication/tests/unit/test_syncdutils.py | 30 +++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 geo-replication/tests/__init__.py create mode 100644 geo-replication/tests/unit/__init__.py create mode 100644 geo-replication/tests/unit/test_syncdutils.py (limited to 'geo-replication/tests') diff --git a/geo-replication/tests/__init__.py b/geo-replication/tests/__init__.py new file mode 100644 index 00000000000..23adbfa5171 --- /dev/null +++ b/geo-replication/tests/__init__.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# +# Copyright (c) 2011-2014 Red Hat, Inc. +# This file is part of GlusterFS. + +# This file is licensed to you under your choice of the GNU Lesser +# General Public License, version 3 or any later version (LGPLv3 or +# later), or the GNU General Public License, version 2 (GPLv2), in all +# cases as published by the Free Software Foundation. +# diff --git a/geo-replication/tests/unit/__init__.py b/geo-replication/tests/unit/__init__.py new file mode 100644 index 00000000000..23adbfa5171 --- /dev/null +++ b/geo-replication/tests/unit/__init__.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# +# Copyright (c) 2011-2014 Red Hat, Inc. +# This file is part of GlusterFS. + +# This file is licensed to you under your choice of the GNU Lesser +# General Public License, version 3 or any later version (LGPLv3 or +# later), or the GNU General Public License, version 2 (GPLv2), in all +# cases as published by the Free Software Foundation. +# diff --git a/geo-replication/tests/unit/test_syncdutils.py b/geo-replication/tests/unit/test_syncdutils.py new file mode 100644 index 00000000000..736ae274b85 --- /dev/null +++ b/geo-replication/tests/unit/test_syncdutils.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# +# Copyright (c) 2011-2014 Red Hat, Inc. +# This file is part of GlusterFS. + +# This file is licensed to you under your choice of the GNU Lesser +# General Public License, version 3 or any later version (LGPLv3 or +# later), or the GNU General Public License, version 2 (GPLv2), in all +# cases as published by the Free Software Foundation. +# + +import unittest + +from syncdaemon import syncdutils + + +class SyncdutilsTestCase(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + pass + + def test_escape(self): + self.assertEqual(syncdutils.escape("http://gluster.org"), + "http%3A%2F%2Fgluster.org") + + def test_unescape(self): + self.assertEqual(syncdutils.unescape("http%3A%2F%2Fgluster.org"), + "http://gluster.org") -- cgit