This commit is contained in:
Ludovic Stephan 2021-02-24 00:31:56 +01:00
parent 16dee0c143
commit b9aaf6a19c

View file

@ -1926,8 +1926,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase):
["[kfet] Enregistrer des commandes avec commentaires"],
)
def test_group_on_acc_frozen(self):
user_add_perms(self.users["team"], ["kfet.override_frozen_protection"])
def test_error_on_acc_frozen(self):
self.account.is_frozen = True
self.account.save()
@ -1944,30 +1943,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase):
)
resp = self.client.post(self.url, data)
self._assertResponseOk(resp)
def test_invalid_group_on_acc_frozen_requires_perm(self):
self.account.is_frozen = True
self.account.save()
data = dict(
self.base_post_data,
**{
"comment": "A comment to explain it",
"form-TOTAL_FORMS": "1",
"form-0-type": "purchase",
"form-0-amount": "",
"form-0-article": str(self.article.pk),
"form-0-article_nb": "2",
}
)
resp = self.client.post(self.url, data)
self.assertEqual(resp.status_code, 403)
self.assertEqual(resp.status_code, 400)
json_data = json.loads(resp.content.decode("utf-8"))
self.assertEqual(
json_data["errors"]["missing_perms"], ["[kfet] Forcer le gel d'un compte"]
)
self.assertEqual(json_data["errors"]["frozen"], [self.account.trigramme])
def test_invalid_group_checkout(self):
self.checkout.valid_from -= timedelta(days=300)