def setUp(self): self.addCleanup(self._cleanup_wiki_db) self._setup_wiki_db() self.addCleanup(self._cleanup_wp_one_db) self._setup_wp_one_db() self.app = create_app() self.app.config['TESTING'] = True
def test_rq_no_login(self, patched_get_creds): patched_get_creds.return_value = { 'host': 'localhost', 'port': 6379, } os.environ['RQ_USER'] = '******' os.environ['RQ_PASS'] = '******' # nosec self.app = create_app() with self.app.test_client() as client: rv = client.get('/rq', follow_redirects=True) self.assertTrue(b'Please login' in rv.data)
def setUp(self): self.addCleanup(self._cleanup_wiki_db) self._setup_wiki_db() self.addCleanup(self._cleanup_wp_one_db) self._setup_wp_one_db() self.redis = fakeredis.FakeStrictRedis() self.app = create_app() self.app.config['TESTING'] = True
def test_rq_login(self, patched_get_creds): patched_get_creds.return_value = { 'host': 'localhost', 'port': 6379, } os.environ['RQ_USER'] = '******' os.environ['RQ_PASS'] = '******' # nosec self.app = create_app() with self.app.test_client() as client: rv = client.get( '/rq', headers={ 'Authorization': 'Basic {}'.format( b64encode(b'testuser:testpass').decode('utf-8')) }, follow_redirects=True) self.assertFalse(b'Please login' in rv.data)