From d241ffb36ea655563891b49fb32e6d042b86401a Mon Sep 17 00:00:00 2001 From: Heather Piwowar Date: Tue, 31 Mar 2015 12:39:25 -0700 Subject: [PATCH] add test file stubs --- test/__init__.py | 0 test/data/__init__.py | 0 test/test_refsets.py | 18 ++++++++++++++++++ test/utils.py | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 test/__init__.py create mode 100644 test/data/__init__.py create mode 100644 test/test_refsets.py create mode 100644 test/utils.py diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/data/__init__.py b/test/data/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/test_refsets.py b/test/test_refsets.py new file mode 100644 index 00000000..14917727 --- /dev/null +++ b/test/test_refsets.py @@ -0,0 +1,18 @@ +import unittest +from nose.tools import nottest +from nose.tools import assert_equals +from nose.tools import assert_not_equals +from nose.tools import assert_true +from nose.tools import assert_items_equal + + +from test.utils import setup_redis_for_unittests + +class TestRefsets(unittest.TestCase): + + def setUp(self): + self.r = setup_redis_for_unittests() + + def test_from_url(self): + self.r.set("test", "foo") + assert_equals(self.r.get("test"), "foo") diff --git a/test/utils.py b/test/utils.py new file mode 100644 index 00000000..c30286ae --- /dev/null +++ b/test/utils.py @@ -0,0 +1,18 @@ +import redis + +REDIS_UNITTEST_DATABASE_NUMBER = 15 + +def slow(f): + f.slow = True + return f + +def http(f): + f.http = True + return f + +def setup_redis_for_unittests(): + # do the same thing for the redis db, set up the test redis database. We're using DB Number 8 + r = redis.from_url("redis://localhost:6379", db=REDIS_UNITTEST_DATABASE_NUMBER) + r.flushdb() + return r +