def test_publish_template(self): template = create_a_template() db.session.add(template) db.session.commit() # assert that the right template is used self.client.get('/build/1/publish') self.assert_template_used('builder/preview.html') # assert that the post sets the publish flag to true post = self.client.post('/build/1/publish') template = TemplateBase.query.get(1) self.assertTrue(template.published) assert post.location == 'http://localhost/build/'
def setUp(self): # setUp the super class super(TestEditTemplate, self).setUp() template = create_a_template() db.session.add(template) db.session.commit() sections = [['title1', 'text1'], ['title2', 'text2']] for section in sections: section = create_a_text_section(section[0], section[1]) db.session.add(section) db.session.commit() self.assertEquals(len(TemplateSection.query.all()), 2)