Complete authentication and profile features
This commit is contained in:
@@ -100,11 +100,15 @@ def test_submit_link_stores_cleaned_url_and_public_feed():
|
||||
matching = next(item for item in feed if item['id'] == data['id'])
|
||||
assert matching['comment'] == 'Interesting read'
|
||||
assert matching['user']['username'] == 'alice'
|
||||
assert 'avatar_url' in matching['user']
|
||||
|
||||
filtered_response = client.get('/api/public/feed/alice')
|
||||
assert filtered_response.status_code == 200
|
||||
assert all(item['user']['username'] == 'alice' for item in filtered_response.json())
|
||||
assert client.get('/api/public/feed/does-not-exist').json() == []
|
||||
users_response = client.get('/api/public/users')
|
||||
assert users_response.status_code == 200
|
||||
assert 'alice' in users_response.json()
|
||||
|
||||
|
||||
def test_logout_revokes_token_and_admin_can_list_plugins():
|
||||
@@ -129,7 +133,13 @@ def test_public_and_admin_pages_render_html():
|
||||
assert 'LinkLog' in root_page.text
|
||||
assert 'class="login-button" href="/login"' in root_page.text
|
||||
assert client.get('/alice').status_code == 200
|
||||
assert 'alice' in client.get('/alice').text
|
||||
assert client.get('/alice/').status_code == 200
|
||||
user_page = client.get('/alice').text
|
||||
assert 'alice' in user_page
|
||||
assert 'data-user-filter="alice"' in user_page
|
||||
assert 'profile-summary' in user_page
|
||||
feed_script = TestClient(app).get('/static/feed.js?v=4').text
|
||||
assert 'window.location.assign(selectedUser ? `/${encodeURIComponent(selectedUser)}/` : \'/\')' in feed_script
|
||||
assert client.get('/login').status_code == 200
|
||||
assert 'Sign in' in client.get('/login').text
|
||||
assert client.get('/admin').status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user