def setup_method(self, method): TestCase.setup_method(self, method) self.app.add_url_rule('/users/<int:id>', view_func=ShowView.as_view('show', model_class=self.User), ) user = self.User(name=u'John Matrix') self.db.session.add(user) self.db.session.commit()
def test_raises_template_not_found_for_invalid_template(self): self.app.add_url_rule('/users/<int:id>', view_func=ShowView.as_view( 'show', model_class=self.User, template='invalid.html' ), ) with raises(TemplateNotFound): self.client.get('/users/1')