Exemplo n.º 1
0
    def test_view(self):
        """Test the displaying of the tag view"""
        self.clear_db()
        self.register_and_login('barney', 'abc')
        tag = Tag('drdre')
        db.session.add(tag)
        db.session.commit()
        post = Post('the chronic 2001', visible=True)
        post2 = Post('the chronic 2002', visible=False)
        post._tags = [tag]
        post2._tags = [tag]
        db.session.add(post)
        db.session.add(post2)
        db.session.commit()
        rv = self.client.get('/tag/drdre/')
        self.assert_200(rv)
        assert 'the chronic 2001' in rv.data
        rv = self.client.get('/tag/bobbybrown/')
        self.assert_404(rv)

        self.logout()
        rv = self.client.get('/tag/drdre/')
        self.assert_200(rv)
        assert 'the chronic 2001' in rv.data
        assert 'the chronic 2002' not in rv.data
Exemplo n.º 2
0
 def test_view(self):
     """Test the displaying of the tag view"""
     self.clear_db()
     self.register_and_login('barney', 'abc')
     tag = Tag('drdre')
     db.session.add(tag)
     db.session.commit()
     post = Post('the chronic 2001', visible=True)
     post2 = Post('the chronic 2002', visible=False)
     post._tags = [tag]
     post2._tags = [tag]
     db.session.add(post)
     db.session.add(post2)
     db.session.commit()
     rv = self.client.get('/tag/drdre/')
     self.assert_200(rv)
     assert 'the chronic 2001' in rv.data
     rv = self.client.get('/tag/bobbybrown/')
     self.assert_404(rv)
     
     self.logout()
     rv = self.client.get('/tag/drdre/')
     self.assert_200(rv)
     assert 'the chronic 2001' in rv.data
     assert 'the chronic 2002' not in rv.data