mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-05 12:41:49 +02:00
fix tests
This commit is contained in:
parent
ef92181786
commit
7d3d6693e8
3 changed files with 8 additions and 8 deletions
|
@ -322,7 +322,7 @@ class Project(db.Model):
|
|||
db.session.add(self)
|
||||
db.session.commit()
|
||||
|
||||
def import_bills(self, bills: list[dict]):
|
||||
def import_bills(self, bills: list):
|
||||
"""Import bills from a list of dictionaries"""
|
||||
# Add members not already in the project
|
||||
members_project = [str(m) for m in self.members]
|
||||
|
@ -621,14 +621,14 @@ class Bill(db.Model):
|
|||
def __init__(
|
||||
self,
|
||||
amount: float,
|
||||
date: object = None,
|
||||
date: datetime = None,
|
||||
external_link: str = "",
|
||||
original_currency: str = "",
|
||||
owers: list[Person] = [],
|
||||
owers: list = [],
|
||||
payer_id: int = None,
|
||||
project_default_currency: str = "",
|
||||
what: str = "",
|
||||
) -> None:
|
||||
):
|
||||
super().__init__()
|
||||
self.amount = amount
|
||||
self.date = date
|
||||
|
|
|
@ -153,7 +153,7 @@ class ModelsTestCase(IhatemoneyTestCase):
|
|||
},
|
||||
)
|
||||
|
||||
project = self.get_project_by_name(name="raclette")
|
||||
project = models.Project.query.get_by_name(name="raclette")
|
||||
zorglub = models.Person.query.get_by_name(name="zorglub", project=project)
|
||||
zorglub_bills = models.Bill.query.options(
|
||||
orm.subqueryload(models.Bill.owers)
|
||||
|
|
|
@ -13,7 +13,6 @@ from functools import wraps
|
|||
import json
|
||||
import os
|
||||
|
||||
from dateutil.parser import parse
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from flask import (
|
||||
Blueprint,
|
||||
|
@ -454,7 +453,7 @@ def import_project():
|
|||
elif data.mimetype == "text/csv":
|
||||
try:
|
||||
bills = csv2list_of_dicts(data)
|
||||
except Exception as b:
|
||||
except Exception:
|
||||
raise ValueError(_("Unable to parse CSV"))
|
||||
else:
|
||||
raise ValueError("Unsupported file type")
|
||||
|
@ -484,7 +483,8 @@ def import_project():
|
|||
if len(currencies - {CurrencyConverter.no_currency}) >= 2:
|
||||
raise ValueError(
|
||||
_(
|
||||
"Cannot add bills in multiple currencies to a project without default currency"
|
||||
"Cannot add bills in multiple currencies to a project without default "
|
||||
"currency"
|
||||
)
|
||||
)
|
||||
# Strip currency from bills (since it's the same for every bill)
|
||||
|
|
Loading…
Reference in a new issue