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)
def test_should_return_none_given_invalid_id(self): view = View.get(2) self.assertEqual(view, None)
def test_should_return_view_given_valid_id(self): view = View.get(1) self.assertEqual(view, self.view)