Esempio n. 1
0
            print(DEPS_NOTFOUND_HELP % e)
        else:
            return True


def config_validator():
    '''Make sure the config file is ready.'''
    # Checking if oauth token is configured
    if app.config['OAUTH_TOKEN'] == '':
        sys.exit(TOKEN_HELP)

if __name__ == '__main__':
    # testing the config file
    config_validator()
    # Parsing arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('-t', '--testmode', action='store_true',
                        help='Run server in "test mode".')
    args = parser.parse_args()

    if args.testmode:
        # disable HttpOnly setting for session cookies so Selenium
        # can interact with them. *ONLY* do this for testing.
        app.config['SESSION_COOKIE_HTTPONLY'] = False
        app.config['TESTING'] = True
        print("Starting server in ~*TEST MODE*~")
        app.run(host='localhost')
    else:
        if check_pip_deps():
            app.run(host='localhost')
Esempio n. 2
0

def config_validator():
    '''Make sure the config file is ready.'''
    # Checking if oauth token is configured
    if app.config['OAUTH_TOKEN'] == '':
        sys.exit(TOKEN_HELP)


if __name__ == '__main__':
    # testing the config file
    config_validator()
    # Parsing arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('-t',
                        '--testmode',
                        action='store_true',
                        help='Run server in "test mode".')
    args = parser.parse_args()

    if args.testmode:
        # disable HttpOnly setting for session cookies so Selenium
        # can interact with them. *ONLY* do this for testing.
        app.config['SESSION_COOKIE_HTTPONLY'] = False
        app.config['TESTING'] = True
        print("Starting server in ~*TEST MODE*~")
        app.run(host='localhost')
    else:
        if check_pip_deps():
            app.run(host='localhost')
Esempio n. 3
0
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from webcompat import app

if __name__ == '__main__':
    app.run()
Esempio n. 4
0
    # Checking if oauth token is configured
    if app.config['OAUTH_TOKEN'] == '':
        sys.exit(TOKEN_HELP)


if __name__ == '__main__':
    # Parsing arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('-t', '--testmode', action='store_true',
                        help='Run server in "test mode".')
    parser.add_argument('-l', '--listen', default='localhost',
                        help='Interface to listen on.')
    args = parser.parse_args()

    if check_pip_deps():
        if not args.testmode:
            # testing the config file.
            # this file is only important in non-test mode.
            # in test mode everything must be mocked,
            # so there is no external api communication.
            config_validator()
            app.run(host=args.listen)
        else:
            # disable HttpOnly setting for session cookies so Selenium
            # can interact with them. *ONLY* do this for testing.
            app.config['SESSION_COOKIE_HTTPONLY'] = False
            app.config['SESSION_COOKIE_SAMESITE'] = None
            app.config['TESTING'] = True
            print("Starting server in ~*TEST MODE*~")
            app.run(host=args.listen)
Esempio n. 5
0
if __name__ == '__main__':
    # Parsing arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('-t',
                        '--testmode',
                        action='store_true',
                        help='Run server in "test mode".')
    parser.add_argument('-l',
                        '--listen',
                        default='localhost',
                        help='Interface to listen on.')
    args = parser.parse_args()

    if check_pip_deps():
        if not args.testmode:
            # testing the config file.
            # this file is only important in non-test mode.
            # in test mode everything must be mocked,
            # so there is no external api communication.
            config_validator()
            app.run(host=args.listen)
        else:
            # disable HttpOnly setting for session cookies so Selenium
            # can interact with them. *ONLY* do this for testing.
            app.config['SESSION_COOKIE_HTTPONLY'] = False
            app.config['SESSION_COOKIE_SAMESITE'] = None
            app.config['TESTING'] = True
            print("Starting server in ~*TEST MODE*~")
            app.run(host=args.listen)
Esempio n. 6
0
BOT_HELP = 'BOT OAUTH TOKEN NOT SET'


def config_validator():
    '''Make sure the config file is ready.'''
    # Checking if there is a bot configured
    if app.config['BOT_OAUTH_TOKEN'] == '':
        sys.exit(BOT_HELP)


if __name__ == '__main__':
    # testing the config file
    config_validator()
    # Parsing arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('-t',
                        '--testmode',
                        action='store_true',
                        help='Run server in "test mode".')
    args = parser.parse_args()

    if args.testmode:
        # disable HttpOnly setting for session cookies so Selenium
        # can interact with them. *ONLY* do this for testing.
        app.config['SESSION_COOKIE_HTTPONLY'] = False
        print("Starting server in ~*TEST MODE*~")
        app.run()
    else:
        app.run()