def test_new_idea(self): content = 'hello world' before = Idea.count() rv = self.post('new_idea', page_id=1, data=dict(content=content)) after = Idea.count() assert rv.status_code == HTTP_OK assert before + 1 == after
def setup_method(self, method): super(TestGet, self).setup_method(method) Page.new() Page.new() Idea.new(1, 'hello') Idea.new(2, 'hello') Idea.new(2, 'hello') Idea.new(2, 'hello')
def test_import_text(self): text = """ the first paragraph. a sentence. ellipsis.. end. the second paragraph. another sentence.""" before_page = Page.count() before_idea = Idea.count() rv = self.post('import_text', data=dict(text=text)) assert rv.status_code == HTTP_REDIRECT after_page = Page.count() after_idea = Idea.count() assert before_page + 1 == after_page assert before_idea + 5 == after_idea assert Page.get(after_page).struct == '5 [ 6 7 ] 8 [ 9 ] '
def test_remove_idea(self): rv = self.post('save_page', page_id=1, data=dict(struct='')) assert rv.status_code == HTTP_OK assert Idea.get(1).reference_count == 0