Exemple #1
0
def update(id):
    view = View.get(id)
    try:
        receipt_image = request.files["receipt_image"]
    except KeyError:
        receipt_image = None
    if receipt_image:
        save_image(receipt_image)
    checked_permissions = get_checked_permissions()
    view.update_permissions(checked_permissions)
    if not request.referrer:
        url = url_for('home.main_page')
    else:
        url = request.referrer

    return redirect(url)
Exemple #2
0
    def test_should_return_none_given_invalid_id(self):
        view = View.get(2)

        self.assertEqual(view, None)
Exemple #3
0
    def test_should_return_view_given_valid_id(self):
        view = View.get(1)

        self.assertEqual(view, self.view)