Пример #1
0
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)
Пример #2
0
    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')
Пример #3
0
    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')