Skip to content

Commit

Permalink
add test file stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
hpiwowar committed Mar 31, 2015
1 parent 1fbcbc1 commit d241ffb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Empty file added test/__init__.py
Empty file.
Empty file added test/data/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions test/test_refsets.py
Original file line number Diff line number Diff line change
@@ -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")
18 changes: 18 additions & 0 deletions test/utils.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d241ffb

Please sign in to comment.