mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
tests: allow to choose project name independently from ID (no change by default)
This commit is contained in:
parent
45f0f0e7e9
commit
7fdb72cff8
1 changed files with 15 additions and 9 deletions
|
@ -50,27 +50,33 @@ class BaseTestCase(TestCase):
|
|||
follow_redirects=True,
|
||||
)
|
||||
|
||||
def post_project(self, name, follow_redirects=True, default_currency="XXX"):
|
||||
def post_project(
|
||||
self, id, follow_redirects=True, default_currency="XXX", name=None
|
||||
):
|
||||
"""Create a fake project"""
|
||||
if name is None:
|
||||
name = id
|
||||
# create the project
|
||||
return self.client.post(
|
||||
"/create",
|
||||
data={
|
||||
"name": name,
|
||||
"id": name,
|
||||
"password": name,
|
||||
"contact_email": f"{name}@notmyidea.org",
|
||||
"id": id,
|
||||
"password": id,
|
||||
"contact_email": f"{id}@notmyidea.org",
|
||||
"default_currency": default_currency,
|
||||
},
|
||||
follow_redirects=follow_redirects,
|
||||
)
|
||||
|
||||
def create_project(self, name, default_currency="XXX"):
|
||||
def create_project(self, id, default_currency="XXX", name=None):
|
||||
if name is None:
|
||||
name = str(id)
|
||||
project = models.Project(
|
||||
id=name,
|
||||
name=str(name),
|
||||
password=generate_password_hash(name),
|
||||
contact_email=f"{name}@notmyidea.org",
|
||||
id=id,
|
||||
name=name,
|
||||
password=generate_password_hash(id),
|
||||
contact_email=f"{id}@notmyidea.org",
|
||||
default_currency=default_currency,
|
||||
)
|
||||
models.db.session.add(project)
|
||||
|
|
Loading…
Reference in a new issue