Fix tests

This commit is contained in:
Ludovic Stephan 2019-11-29 15:33:03 +01:00
parent 361ad46be4
commit 85aa56d030
2 changed files with 13 additions and 6 deletions

View file

@ -3,6 +3,7 @@
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/transfers_form.css' %}">
<script type="text/javascript" src="{% url 'js_reverse' %}" ></script>
{% endblock %}
{% block title %}Nouveaux transferts{% endblock %}
@ -54,9 +55,8 @@ $(document).ready(function () {
function getAccountData(trigramme, callback = function() {}) {
$.ajax({
dataType: "json",
url : "{% url 'kfet.account.read.json' %}",
method : "POST",
data : { trigramme: trigramme },
url : django_urls["kfet.account.read.json"]({trigramme: trigramme}),
method : "GET",
success : callback,
});
}

View file

@ -4088,15 +4088,22 @@ class HistoryJSONViewTests(ViewTestCaseMixin, TestCase):
class AccountReadJSONViewTests(ViewTestCaseMixin, TestCase):
url_name = "kfet.account.read.json"
url_expected = "/k-fet/accounts/read.json"
http_methods = ["POST"]
http_methods = ["GET"]
auth_user = "team"
auth_forbidden = [None, "user"]
@property
def url_kwargs(self):
return {"trigramme": self.accounts["user"].trigramme}
@property
def url_expected(self):
return "/k-fet/accounts/{}/.json".format(self.accounts["user"].trigramme)
def test_ok(self):
r = self.client.post(self.url, {"trigramme": "000"})
r = self.client.get(self.url)
self.assertEqual(r.status_code, 200)
content = json.loads(r.content.decode("utf-8"))