コード例 #1
0
    def setUp(self):
        super(BaseTestCase, self).setUp()
        self.app = create_app(config.Testing)
        self.app_context = self.app.app_context()
        self.client = self.app.test_client()
        self.app_context.push()
        self.db = db
        self.db.drop_all()
        self.db.create_all()
        self.user = dict(username="******",
                         password="******",
                         first_name="Test",
                         last_name="User",
                         _admin=True)
        self.document = dict(title="This is a Test Title",
                             body="Body Body Body, likeasomebody")
        self.tag = {"title": "TAGGY"}

        self.default_user = User.create(self.user)
        self.default_document = Document.create(self.document)
        self.default_document.user = self.default_user
        self.tag = Tag.create(self.tag)
        self.tag.user = self.default_user
        self.default_document.tags.append(self.tag)
        self.db.session.commit()
        self.redis_store = RedisStore(store=FakeStrictRedis, name='test')
        token = jwt.create_token_for_user(self.default_user)
        self.headers = [('Content-Type', 'application/json'),
                        ('Authorization', 'Bearer %s' % token)]
コード例 #2
0
 def setUp(self):
     self.prefix = 'test'
     self.redis_store = RedisStore(store=FakeStrictRedis, name=self.prefix)