def setUp(self): """ Set up """ # Init Flask ctx self.ctx = app.app.app_context() self.ctx.push() app.get_redis() print("\n" + "_" * 50 + "\n")
def setUpClass(cls): """ Initializes the database """ # Define test database print("Setting up tests for CELERY TASKS") if config.TESTING: with app.app.app_context(): app.get_redis() print("Connected to Redis")
def test_pad_set(self): with a.app.app_context(): rs = a.get_redis() a.pad_set('foo', 'bar') a.pad_set('foobar', 'foobar') self.assertEqual(rs.get('pad:foo'), 'bar') self.assertEqual(rs.get('pad:foobar'), 'foobar')
def flush(): r = get_redis() r.flushdb()