Example #1
0
def test():
    with app.app_context():
        init_db()
        g.db = db_proxy
        g.db.connect()

        import all_tests.server_tests as tests

        g.db.drop_tables([AdminPage, TargetGroup, UserPage, SenderPage],
                         safe=True)  # TODO delete it
        create_db()

        tests.test_add_admin()
        tests.test_add_group()
        tests.test_add_sender()

        tests.test_change_mess_count()
        tests.test_change_text()
        tests.test_run_sender()

        tests.test_consumer_reply()
        tests.test_forward_messages()

        tests.test_consumer_mess()
        tests.test_not_command_mes()

        logger.info('All all_tests are passed!')
        return 'ok'
Example #2
0
def test():
    with app.app_context():
        init_db()
        g.db = db_proxy
        g.db.connect()

        import all_tests.vk.request_tests as tests

        g.db.drop_tables([Account, Subscription, Messenger, AccessToken])
        create_db()

        tests.test_start()
        tests.test_add_indox_task()
        tests.test_add_project_task(
            proj_name='Work',
            content='В Work это новая задача в проекте',
            task='это новая задача в проекте')

        tests.test_add_project_task(
            proj_name='Work',
            content='Это новая задача в проекте в Work ',
            task='Это новая задача в проекте')
        tests.test_add_forwarded_mess()
        tests.test_add_task_with_date()

        logger.info('All tests are passed!')
        return 'ok'
Example #3
0
def before_request():
    global vkbot
    if vkbot == None:
        vkbot = VKBot(get_token())

    init_db()
    g.db = db_proxy
    g.db.connect()
Example #4
0
def test():
    with app.app_context():
        init_db()
        g.db = db_proxy
        g.db.connect()

        import tests.server_tests as tests

        g.db.drop_tables([AdminPage, TargetGroup, UserPage, SenderPage],
                         safe=True)  # TODO delete it
        create_db()

        for i in dir(tests):
            item = getattr(tests, i)
            if callable(item) and repr(item).find('test_') != -1:
                print('Test' + repr(item) + ' started!')
                item()

                print('Test' + repr(item) + ' ended!')

        logger.info('All tests are passed!')
        return 'ok'
def before_request():
    init_db()
    g.db = db_proxy
    g.db.connect()