mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
add test for multiple join
This commit is contained in:
parent
2fcea313cd
commit
cc18986b76
1 changed files with 23 additions and 1 deletions
|
@ -5,7 +5,7 @@ from time import sleep
|
|||
import unittest
|
||||
from urllib.parse import urlparse, urlunparse
|
||||
|
||||
from flask import session
|
||||
from flask import session, url_for
|
||||
import pytest
|
||||
from werkzeug.security import check_password_hash, generate_password_hash
|
||||
|
||||
|
@ -121,6 +121,28 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
resp = self.client.get("/raclette/join/token.invalid", follow_redirects=True)
|
||||
self.assertIn("Provided token is invalid", resp.data.decode("utf-8"))
|
||||
|
||||
def test_multiple_join(self):
|
||||
"""Test that joining multiple times a project doesn't add it multiple times in the session"""
|
||||
self.login("raclette")
|
||||
self.post_project("raclette")
|
||||
project = self.get_project("raclette")
|
||||
invite_link = url_for(
|
||||
".join_project",
|
||||
project_id="raclette",
|
||||
token=project.generate_token()
|
||||
)
|
||||
|
||||
self.post_project("tartiflette")
|
||||
self.client.get(invite_link)
|
||||
data = self.client.get("/tartiflette/").data.decode("utf-8")
|
||||
# First join is OK
|
||||
assert 'href="/raclette/"' in data
|
||||
|
||||
# Second join shouldn't add a double link
|
||||
self.client.get(invite_link)
|
||||
data = self.client.get("/tartiflette/").data.decode("utf-8")
|
||||
assert data.count('href="/raclette/"') == 1
|
||||
|
||||
def test_invite_code_invalidation(self):
|
||||
"""Test that invitation link expire after code change"""
|
||||
self.login("raclette")
|
||||
|
|
Loading…
Reference in a new issue