Ejemplo n.º 1
0
        if i in sample_bans:
            sample_ban = BannedIPs(date=last_month)
            sample_ban.ipaddr = ip_entry.id
            db.session.add(sample_ban)
            db.session.commit()


def create_test_posts():
    p1 = Post("Test Post", "test_post")
    p1.add_category("Testing", "テスト中")
    p1.add_tags("test;experiment", "テスト;実験")
    p1.add_body("This is a test post.", "これはテストの書き込みです。")
    p1.published = True
    p1.date = datetime.now() - timedelta(hours=p1.get_tz_offset())
    db.session.add(p1)
    db.session.commit()
    p2 = Post("Another Test Post", "another_test_post")
    p2.add_category("Testing Another")
    p2.add_tags("test;experiment")
    p2.add_body("This is another test post.")
    db.session.add(p2)
    db.session.commit()


if __name__ == "__main__":
    db.create_all()
    # create_test_posts()
    # Automatically create a test admin? Import from setup
    create_test_monitoring()
Ejemplo n.º 2
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['CSRF_ENABLED'] = False
     app.config['SQLALCHEMY_DATABASE_URI'] = TEST_DATABASE_URI
     self.app = app.test_client()
     db.create_all()