1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Fix project deletion. fix #87

This commit is contained in:
Alexis Metaireau 2012-09-02 13:53:01 +02:00
parent e75809dddf
commit 6a544855d7
3 changed files with 22 additions and 3 deletions

View file

@ -3,7 +3,7 @@
{% block js %}
$('#delete-project').click(function ()
{
$(this).html("<a style='color:red; ' href='{{ url_for('.remove_project') }}' >{{_("you sure?")}}</a>");
$(this).html("<a style='color:red; ' href='{{ url_for('.delete_project') }}' >{{_("you sure?")}}</a>");
});
{% endblock %}

View file

@ -147,6 +147,24 @@ class BudgetTestCase(TestCase):
# no new project added
self.assertEqual(len(models.Project.query.all()), 1)
def test_project_deletion(self):
with run.app.test_client() as c:
c.post("/create", data={
'name': 'raclette party',
'id': 'raclette',
'password': 'party',
'contact_email': 'raclette@notmyidea.org'
})
# project added
self.assertEqual(len(models.Project.query.all()), 1)
c.get('/raclette/delete')
# project removed
self.assertEqual(len(models.Project.query.all()), 0)
def test_membership(self):
self.post_project("raclette")
self.login("raclette")

View file

@ -205,9 +205,10 @@ def edit_project():
return render_template("edit_project.html", form=form)
@main.route("/<project_id>/delete", methods=["POST"])
def remove_project():
@main.route("/<project_id>/delete")
def delete_project():
g.project.remove_project()
flash(_('Project successfully deleted'))
return redirect(url_for(".home"))