Skip to content

Commit

Permalink
test: add test for search w/ basic auth
Browse files Browse the repository at this point in the history
  • Loading branch information
wzyboy committed Jul 10, 2023
1 parent 5b2f572 commit 3e35d17
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ def test_search(self, client):
for kw in self.keywords:
assert kw in resp.text

def test_search_with_basic_auth(self, client):
db = {
'username': 'foo',
'password': 'bar'
}
client.application.config['T_SEARCH_BASIC_AUTH'] = db
resp = client.get('/tweet/search.html')
assert resp.status_code == 401
resp = client.get('/tweet/search.html', auth=(db['username'], db['password']))
assert '<option value="wzyboy">' in resp.text


class TestMediaReplacement:
tweet_id = '1615425412921987074'
Expand Down

0 comments on commit 3e35d17

Please sign in to comment.