def create_dojo(): form = DojoForm() if form.validate_on_submit(): dojo = Dojo(name=form.name.data, description=form.description.data, address=form.address.data) dojo.put() return "Saved" return render_template("new_dojo.html", form=form)
def test_create_dojo_view(self): "Should contain a view that creates a dojo on database on POST requests" with app.test_request_context(): post_data = { 'name' : u'Main dojo', 'description' : u'The main dojo of the entire universe', 'address' : u'Main street, 20' } response = self.client.post("/dojo/new", data=post_data, follow_redirects=True) assert_equals(response.status_code, 200) dojo = Dojo.all().filter('name =', u'Main dojo').get() assert_equals(dojo.address, u'Main street, 20')
def test_create_dojo_view(self): "Should contain a view that creates a dojo on database on POST requests" with app.test_request_context(): post_data = { 'name': u'Main dojo', 'description': u'The main dojo of the entire universe', 'address': u'Main street, 20' } response = self.client.post("/dojo/new", data=post_data, follow_redirects=True) assert_equals(response.status_code, 200) dojo = Dojo.all().filter('name =', u'Main dojo').get() assert_equals(dojo.address, u'Main street, 20')