forked from DGNum/gestioCOF
Fix tests
This commit is contained in:
parent
f10d6d1a71
commit
c9dad9465a
1 changed files with 54 additions and 14 deletions
|
@ -628,37 +628,51 @@ class AccountStatOperationListViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
expected_stats = [
|
||||
{
|
||||
"label": "Derniers mois",
|
||||
"label": "Tout le temps",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"scale_n_steps": ["7"],
|
||||
"types": ["['purchase']"],
|
||||
"scale_name": ["month"],
|
||||
"scale_last": ["True"],
|
||||
"scale_begin": [
|
||||
self.accounts["user1"].created_at.isoformat(" ")
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"label": "1 an",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"types": ["['purchase']"],
|
||||
"scale_n_steps": ["12"],
|
||||
"scale_name": ["month"],
|
||||
"scale_last": ["True"],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"label": "Dernières semaines",
|
||||
"label": "3 mois",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"scale_n_steps": ["7"],
|
||||
"types": ["['purchase']"],
|
||||
"scale_n_steps": ["13"],
|
||||
"scale_name": ["week"],
|
||||
"types": ["['purchase']"],
|
||||
"scale_last": ["True"],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"label": "Derniers jours",
|
||||
"label": "2 semaines",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"scale_n_steps": ["7"],
|
||||
"scale_name": ["day"],
|
||||
"types": ["['purchase']"],
|
||||
"scale_n_steps": ["14"],
|
||||
"scale_name": ["day"],
|
||||
"scale_last": ["True"],
|
||||
},
|
||||
},
|
||||
|
@ -1524,6 +1538,21 @@ class ArticleStatSalesListViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.article = Article.objects.create(
|
||||
name="Article", category=ArticleCategory.objects.create(name="Category")
|
||||
)
|
||||
checkout = Checkout.objects.create(
|
||||
name="Checkout",
|
||||
created_by=self.accounts["team"],
|
||||
balance=5,
|
||||
valid_from=self.now,
|
||||
valid_to=self.now + timedelta(days=5),
|
||||
)
|
||||
|
||||
self.opegroup = create_operation_group(
|
||||
on_acc=self.accounts["user"],
|
||||
checkout=checkout,
|
||||
content=[
|
||||
{"type": Operation.PURCHASE, "article": self.article, "article_nb": 2},
|
||||
],
|
||||
)
|
||||
|
||||
def test_ok(self):
|
||||
r = self.client.get(self.url)
|
||||
|
@ -1535,33 +1564,44 @@ class ArticleStatSalesListViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
expected_stats = [
|
||||
{
|
||||
"label": "Derniers mois",
|
||||
"label": "Tout le temps",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"scale_n_steps": ["7"],
|
||||
"scale_name": ["month"],
|
||||
"scale_last": ["True"],
|
||||
"scale_begin": [self.opegroup.at.isoformat(" ")],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"label": "1 an",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"scale_n_steps": ["12"],
|
||||
"scale_name": ["month"],
|
||||
"scale_last": ["True"],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"label": "Dernières semaines",
|
||||
"label": "3 mois",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"scale_n_steps": ["7"],
|
||||
"scale_n_steps": ["13"],
|
||||
"scale_name": ["week"],
|
||||
"scale_last": ["True"],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"label": "Derniers jours",
|
||||
"label": "2 semaines",
|
||||
"url": {
|
||||
"path": base_url,
|
||||
"query": {
|
||||
"scale_n_steps": ["7"],
|
||||
"scale_n_steps": ["14"],
|
||||
"scale_name": ["day"],
|
||||
"scale_last": ["True"],
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue