コード例 #1
0
ファイル: testing.py プロジェクト: lavabyrd/slackedoverflow
 def test_logout_redirect(self):
     tester = app.test_client(self)
     response = tester.get('/logout',
                           content_type='html/text',
                           follow_redirects=True)
     self.assertEqual(response.status_code, 200)
     self.assertTrue(b'Please login to continue' in response.data)
コード例 #2
0
 def setUp(self):
     self.app = app.test_client()
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_memcache_stub()
     self.testbed.init_user_stub()
コード例 #3
0
 def setUp(self):
     config.google_api_key = config.google_api_key or 'PLACEHOLDER'
     from application import app, limiter
     self.uuid = str(uuid4())
     app.config['TESTING'] = True
     limiter.enabled = False
     self.app = app.test_client()
コード例 #4
0
ファイル: base.py プロジェクト: xDuckoff/WebApp
 def setUp(self):
     app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['TEST_DATABASE_URL']
     db.create_all()
     app.config['SOCKET_MODE'] = 'True'
     app.config['WTF_CSRF_ENABLED'] = False
     self.__mockUser()
     self.app = app.test_client()
コード例 #5
0
ファイル: tests.py プロジェクト: rrc4/homegrown
    def setUp(self):
        app.testing = True

        self.client = app.test_client(use_cookies=True)

        self.app_context = app.test_request_context()
        self.app_context.push()
コード例 #6
0
ファイル: tests.py プロジェクト: sgrizan/flamenco
 def setUp(self):
     #self.db_fd,
     app.config[
         'SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/server_test.sqlite'
     app.config['TESTING'] = True
     self.app = app.test_client()
     db.create_all()
コード例 #7
0
 def setUp(self):
     self.app = app.test_client()
     app.config['WTF_CSRF_ENABLED'] = False
     with self.client.session_transaction() as session:
         session['full_name'] = 'Foo Bar'
         session['email_address'] = '*****@*****.**'
         session['organisation_name'] = 'Mock organisation'
コード例 #8
0
ファイル: tests.py プロジェクト: leeming/Pushjet-Server-Api
 def setUp(self):
     config.google_api_key = config.google_api_key or 'PLACEHOLDER'
     from application import app, limiter
     self.uuid = str(uuid4())
     app.config['TESTING'] = True
     limiter.enabled = False
     self.app = app.test_client()
コード例 #9
0
ファイル: tests.py プロジェクト: tarvitz/test-work
    def setUp(self):
        # First, create an instance of the Testbed class.
        self.testbed = testbed.Testbed()
        # Then activate the testbed, which prepares the service stubs for use.
        self.testbed.activate()
        # Next, declare which service stubs you want to use.
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        app.config['TESTING'] = True
        app.config['CSRF_ENABLED'] = False
        self.app = app.test_client()

        self.post = {
            'message_id': 1,
            'message_data': 'data'
        }
        self.put = {
            'message_id': 2,
            'message_data': 'data put',
        }

        self.initial = {
            'message_id': 1,
            'message_data': 'message data',
        }
コード例 #10
0
ファイル: test_user.py プロジェクト: nyabongoedgar/SendIT
    def setUpClass(self):
        self.client = app.test_client()
        self.conn_object = DatabaseConnection()
        self.present_location = {'present_location': 'Bukumiro'}

        self.admin_user = {
            'username': '******',
            'password': '******',
            'email': '*****@*****.**'
        }

        self.user = {
            "username": "******",
            "password": "******",
            "email": "*****@*****.**"
        }

        self.user2 = {
            "username": "******",
            "password": "******",
            "email": "*****@*****.**"
        }
        self.client.post('/api/v2/signup',
                         data=json.dumps(self.user2),
                         content_type="application/json")
コード例 #11
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['DEBUG'] = False
     app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///test.db"
     self.app = app.test_client()
     db.create_all()
コード例 #12
0
 def setUp(self):
     self.myapp = app.test_client()
     self.myapp.testing = True    
     self.headers = {
         'ContentType': 'application/json',
         'dataType': 'json'
     }
コード例 #13
0
 def test_api_branches(self):
     tester = app.test_client(self)
     response = tester.get('/api/branches')
     data = json.loads(response.get_data())
     self.assertEqual(response.status_code, 200)
     self.assertEqual(data['results'][0]['id'],
                      "alfonsolzrg-add-instructions")
コード例 #14
0
 def setUp(self):
     # Flask apps testing. See: http://flask.pocoo.org/docs/testing/
     app.config['TESTING'] = True
     app.config['CSRF_ENABLED'] = False
     app.config['FLASK_CONF'] = 'TEST'
     app.config['WTF_CSRF_ENABLED'] = False  # Needed to disable recaptcha.
     self.app = app.test_client()
コード例 #15
0
class TestRoute(unittest.TestCase):
    app.config['DATABASE_DISCOUNT'] = os.path.join(
        app.root_path, '../discount_codes_test.db')
    app.config['DATABASE_SERIAL'] = os.path.join(app.root_path,
                                                 '../serial_discount_test.db')
    client = app.test_client()

    def test_no_serial_in_route(self):
        rv = self.client.get('/discount')
        self.assertEqual(rv.get_json(),
                         {'error': 'Please enter a serial number'})
        self.assertEqual(rv.status_code, 400)

    def test_wrong_serial_in_route(self):
        rv = self.client.get('/discount?serial_number=wrong')
        self.assertEqual(rv.get_json(),
                         {'error': 'The serial number wrong is unknown'})
        self.assertEqual(rv.status_code, 404)

    def test_good_serial(self):
        rv = self.client.get(
            '/discount?serial_number=5ad/602d79c8-AX-b97c747299-d4250111d8f-CQ'
        )
        self.assertEqual(rv.get_json(), {'discount': 'pwYT9-CvnSS4oHL'})
        self.assertEqual(rv.status_code, 200)
コード例 #16
0
 def setUp(self):
     create_db_dir = _basedir + "/db"
     if not os.path.exists(create_db_dir):
         os.mkdir(create_db_dir, 0755)
     app.config["TESTING"] = True
     app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(_basedir, "db/tests.db")
     self.app = app.test_client()
     db.create_all()
コード例 #17
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config[
         'URI'] = 'mysql+mysqlconnector://adminmaster:adminmaster2020@database-project-pachaqtec.cyzimxz00kka.us-east-1.rds.amazonaws.com:3306/pachaqtecDB'
     self.app = app.test_client()
     db.drop_all()
     db.create_all()
コード例 #18
0
 def setUp(self):
     app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.test_client()
     with self.client.session_transaction() as session:
         session['oauth_token'] = {'access_token': 'token'}
         session['oauth_user'] = {
             'permissions': ['signin', 'dashboard-editor']
         }
コード例 #19
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['DEBUG'] = False
     app.config[
         "SQLALCHEMY_DATABASE_URI"] = f"postgresql://{creds['postgres_user']}:{creds['postgres_password']}@localhost:5432/test_db"
     self.app = app.test_client()
     db.create_all()
コード例 #20
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \
         os.path.join(app.config['BASEDIR'], TEST_DB)
     self.app = app.test_client()
     db.drop_all()
     db.create_all()
コード例 #21
0
 def setUp(self):
     app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.test_client()
     with self.client.session_transaction() as session:
         session['oauth_token'] = {'access_token': 'token'}
         session['oauth_user'] = {
             'permissions': ['signin', 'dashboard-editor']
         }
コード例 #22
0
ファイル: testing.py プロジェクト: lavabyrd/slackedoverflow
 def test_index_no_redirect(self):
     tester = app.test_client(self)
     response = tester.get(
         '/index',
         content_type='html/text',
         follow_redirects=False,
     )
     self.assertEqual(response.status_code, 302)
コード例 #23
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config[
         'SQLALCHEMY_DATABASE_URI'] = 'sqlite:////home/kevin/HonoursProject/tests/testDB.db'
     app.config['DEBUG'] = False
     self.app = app.test_client()
     db.create_all()
コード例 #24
0
ファイル: test_wiki.py プロジェクト: scherbatey/wiki_test
    def setUpClass(cls):
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = 'postgresql://{user}:{password}@{host}/{database}'.format(
                **config)
        app.app_context().push()
        db.init_app(app)

        cls.app = app.test_client()
コード例 #25
0
ファイル: test_routes.py プロジェクト: Dovydas21/login_page
 def test_post(self):
     with app.test_client() as client:
         """
         Send data as POST form to endpoint
         """
         user_2 = {'username': '******', 'password': '******'}
         goodresult = client.post('/api', data=user_2)
         self.assertEqual(200, goodresult.status_code)
コード例 #26
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False

        self.app = app.test_client()
        self.app.testing = True
        self.assertEqual(app.debug, False)
コード例 #27
0
    def setUp(self):
        app.config.from_object('config.TestingConfig')
        self.client = app.test_client()

        db.init_app(app)
        with app.app_context():
            db.create_all()
            user_datastore.create_user(email='test', password=encrypt_password('test'))
            db.session.commit()
コード例 #28
0
ファイル: test.py プロジェクト: nikitaprodanov/OnlineChess
 def test_login_unverifyed_password_credentials(self):
     tester = app.test_client(self)
     response = tester.post('/login',
                            data={
                                'username': '******',
                                'password': '******'
                            },
                            follow_redirects=True)
     self.assertIn(b'Username or password is incorrect', response.data)
コード例 #29
0
ファイル: testing.py プロジェクト: lavabyrd/slackedoverflow
 def test_index_redirect(self):
     tester = app.test_client(self)
     response = tester.get(
         '/index',
         content_type='html/text',
         follow_redirects=True,
     )
     self.assertEqual(response.status_code, 200)
     self.assertTrue(b'Please log in to access this page.' in response.data)
コード例 #30
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config['SQLALCHEMY_DATABASE_URI'] = config.Config.SQLALCHEMY_DATABASE_URI
        self.app = app.test_client()
        db.create_all()

        self.assertEqual(app.debug, False)
コード例 #31
0
ファイル: tests.py プロジェクト: voidfiles/pourover
    def setUp(self):
        super(BusterTestCase, self).setUp()
        # Flask apps testing. See: http://flask.pocoo.org/docs/testing/
        app.config['TESTING'] = True
        app.config['CSRF_ENABLED'] = False
        self.app = app.test_client()

        self.set_response("https://alpha-api.app.net/stream/0/posts", content=FAKE_POST_OBJ_RESP, status_code=200, method="POST")
        self.clear_datastore()
コード例 #32
0
 def setUpClass(cls):
     # creates a test client
     app.config.from_object('config.testing')
     cls.app = app.test_client()
     # propagate the exceptions to the test client
     cls.app.testing = True
     db.drop_all()
     db.create_all()
     init_data()
コード例 #33
0
def client():
    db_fd, app.config['DATABASE'] = tempfile.mkstemp()
    app.config['TESTING'] = True

    with app.test_client() as client:
        yield client

    os.close(db_fd)
    os.unlink(app.config['DATABASE'])
コード例 #34
0
ファイル: test_database.py プロジェクト: Melimet/TKT-STAR
def client():
    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database_test.db'

    app.config['TESTING'] = True

    with app.test_client() as client:
        with app.app_context():
            init_db()
        yield client
コード例 #35
0
 def setUp(self):
     create_db_dir = _basedir + '/db'
     if not os.path.exists(create_db_dir):
         os.mkdir(create_db_dir, 0755)
     app.config['TESTING'] = True
     app.config['SQLALCHEMY_DATABASE_URI'] = ('sqlite:///'
                                 + os.path.join(_basedir, 'db/tests.db'))
     self.app = app.test_client()
     db.create_all()
コード例 #36
0
 def setUp(self):
     create_db_dir = _basedir + '/db'
     if not os.path.exists(create_db_dir):
         os.mkdir(create_db_dir, 0755)
     app.config['TESTING'] = True
     app.config['SQLALCHEMY_DATABASE_URI'] = ('sqlite:///'
                                 + os.path.join(_basedir, 'db/tests.db'))
     self.app = app.test_client()
     db.create_all()
コード例 #37
0
ファイル: test.py プロジェクト: nikitaprodanov/OnlineChess
 def test_login_unexisting_username_credentials(self):
     tester = app.test_client(self)
     response = tester.post('/login',
                            data={
                                'username': '******',
                                'password': '******'
                            },
                            follow_redirects=True)
     self.assertIn(b'Username or password is incorrect', response.data)
コード例 #38
0
ファイル: test.py プロジェクト: nikitaprodanov/OnlineChess
 def test_login_correct_credentials(self):
     tester = app.test_client(self)
     response = tester.post('/login',
                            data={
                                'username': '******',
                                'password': '******'
                            },
                            follow_redirects=True)
     assert response.status == '200 OK'
コード例 #39
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['CSRF_ENABLED'] = False
     self.app = app.test_client()
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_user_stub()
     self.testbed.init_memcache_stub()
コード例 #40
0
 def setUp(self):
     app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.test_client()
     with self.client.session_transaction() as session:
         session['oauth_token'] = {'access_token': 'token'}
         session['oauth_user'] = {
             'permissions': ['signin', 'admin'],
             'name': 'Mr Foo Bar',
             'email': '*****@*****.**'
         }
コード例 #41
0
 def setUp(self):
     app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.test_client()
     with self.client.session_transaction() as session:
         session['oauth_token'] = {'access_token': 'token'}
         session['oauth_user'] = {
             'permissions': ['signin', 'admin'],
             'name': 'Mr Foo Bar',
             'email': '*****@*****.**'
         }
コード例 #42
0
ファイル: harness.py プロジェクト: JSatterf1579/apo-website
 def setUp(self):
     # Flask apps testing. See: http://flask.pocoo.org/docs/testing/
     app.config['TESTING'] = True
     app.config['CSRF_ENABLED'] = False
     self.app = app.test_client()
     # setup app engine test bed
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_user_stub()
コード例 #43
0
 def setUp(self):
     # Flask apps testing. See: http://flask.pocoo.org/docs/testing/
     app.config['TESTING'] = True
     app.config['CSRF_ENABLED'] = False
     self.app = app.test_client()
     # Setups app engine test bed. See: http://code.google.com/appengine/docs/python/tools/localunittesting.html#Introducing_the_Python_Testing_Utilities
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_user_stub()
     self.testbed.init_memcache_stub()
コード例 #44
0
ファイル: tests.py プロジェクト: CGTAdal/flamenco
 def setUp(self):
     # self.db_fd,
     app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/server_test.sqlite"
     app.config["TESTING"] = True
     self.app = app.test_client()
     db.create_all()
     # add fake worker
     worker = Worker(
         hostname="debian", status="enabled", connection="offline", system="Linux", ip_address="127.0.0.1", port=5000
     )
     db.session.add(worker)
     db.session.commit()
コード例 #45
0
ファイル: tests.py プロジェクト: Pushjet/Pushjet-Server-Api
    def setUp(self):
        config.google_api_key = config.google_api_key or 'PLACEHOLDER'

        self.uuid = str(uuid4())
        from application import app

        app.config['TESTING'] = True
        app.config['TESTING_GCM'] = []

        self.gcm = app.config['TESTING_GCM']
        self.app = app.test_client()
        self.app_real = app
コード例 #46
0
ファイル: tests.py プロジェクト: Zack--/code-snippets
    def setUp(self):
        # Flask apps testing. See: http://flask.pocoo.org/docs/testing/
        app.config['TESTING'] = True
        app.config['CSRF_ENABLED'] = False
        self.app = app.test_client()

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_user_stub()
        self.testbed.init_memcache_stub()
        ndb.get_context().clear_cache()
コード例 #47
0
    def setUp(self):
        app.config['WTF_CSRF_ENABLED'] = False
        dash_id = '77f1351a-e62f-47fe-bc09-fc69723573be'
        self.app = app.test_client()
        self.upload_url = \
            '/dashboard/{}/digital-take-up/upload'.format(dash_id)
        self.file_data = {
            'file': (StringIO('Week ending,API,Paper form\n2014-08-05,40,10'),
                     'test_upload.csv')}

        self.upload_spreadsheet_patcher = patch(
            'application.controllers.upload.upload_spreadsheet')
        self.upload_spreadsheet_mock = self.upload_spreadsheet_patcher.start()
        self.upload_spreadsheet_mock.return_value = ([], False)
コード例 #48
0
    def setUp(self):
        """Stuff to do before every test."""

        # party like a rockstar, totally dude.
        print 'SETUP for Flask'

        # Get the Flask test client
        self.client = app.test_client()

        # Show Flask errors that happen during tests
        app.config['TESTING'] = True

        # Connect to test database
        # connect_to_db(app, "postgresql:///test_data")  # not using this now
        connect_to_db(app, "postgres:///crime_data_gis")
コード例 #49
0
ファイル: tests.py プロジェクト: EVMosaic/flamenco
 def setUp(self):
     #self.db_fd,
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/server_test.sqlite'
     app.config['TESTING'] = True
     self.app = app.test_client()
     db.create_all()
     # add fake worker
     worker = Worker(hostname='debian',
             status='enabled',
             connection='offline',
             system='Linux',
             ip_address='127.0.0.1',
             port=5000)
     db.session.add(worker)
     db.session.commit()
コード例 #50
0
 def setUpClass(self):
     # create app package
     pkg = ZipFile('test.zip', 'w')
     pkg.write('testapp/application.py', arcname='application.py')
     pkg.write('testapp/manifest.json', arcname='manifest.json')
     pkg.write('testapp/requirements.txt', arcname='requirements.txt')
     pkg.write('testapp/wsgi.py', arcname='wsgi.py')
     pkg.close()
     # run
     self.pkg = os.path.join(os.path.dirname('.'), 'test.zip')
     if not os.path.exists(self.pkg):
         raise RuntimeError('Error creating test package: {0}'.format(self.pkg))
     self.app = app.test_client()
     # monkey patch app to load custom test_settings
     utils.applications.app = create_app('test_settings')
     self.application = Application()
コード例 #51
0
 def setUp(self):
     app.config['testing'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.debug = True
     app.secret_key = "something_secret"
     app.testing = True
     self.app = app.test_client()
     init_db('sqlite://')
     # login session
     query = dict(state='testingstate')
     self.app.post('/fbconnect', query_string=query, data='testytesttest')
     with open(test_image_name_1, 'r') as test_image:
         self.image_string = StringIO(test_image.read())
     with open(test_image_name_2, 'r') as test_image2:
         self.image2_string = StringIO(test_image2.read())
     del test_image
     del test_image2
コード例 #52
0
    def setUp(self):
        self.dashboards = [
            {
                'url': 'http://stagecraft/dashboard/uuid',
                'public-url': 'http://spotlight/performance/carers-allowance',
                'published': True,
                'status': 'published',
                'id': 'uuid',
                'title': 'Name of service'
            }
        ]

        app.config['WTF_CSRF_ENABLED'] = False
        self.app = app.test_client()
        with self.client.session_transaction() as session:
            session['oauth_token'] = {'access_token': 'token'}
            session['oauth_user'] = {
                'permissions': ['signin', 'dashboard-editor']
            }
コード例 #53
0
    def setUp(self):
        app.config['WTF_CSRF_ENABLED'] = False
        self.dash_id = '77f1351a-e62f-47fe-bc09-fc69723573be'
        self.app = app.test_client()
        self.upload_url = \
            '/dashboard/{}/cost-per-transaction/upload'.format(self.dash_id)
        self.file_data = {
            'file': (StringIO('Week ending,API,Paper form\n2014-08-05,40,10'),
                     'test_upload.csv')}

        self.upload_spreadsheet_patcher = patch(
            'application.controllers.upload.upload_spreadsheet')
        self.upload_spreadsheet_mock = self.upload_spreadsheet_patcher.start()
        self.upload_spreadsheet_mock.return_value = ([], False)

        self.generate_bearer_token_patcher = patch(
            "application.controllers.builder"
            ".cost_per_transaction.generate_bearer_token")
        self.generate_bearer_token_mock = \
            self.generate_bearer_token_patcher.start()
        self.generate_bearer_token_mock.return_value = "abc123def"
コード例 #54
0
ファイル: common_test_class.py プロジェクト: JT-a/pillar
    def setUp(self, **kwargs):
        eve_settings_file = os.path.join(MY_PATH, 'common_test_settings.py')
        pillar_config_file = os.path.join(MY_PATH, 'config_testing.py')
        kwargs['settings_file'] = eve_settings_file
        os.environ['EVE_SETTINGS'] = eve_settings_file
        os.environ['PILLAR_CONFIG'] = pillar_config_file
        super(AbstractPillarTest, self).setUp(**kwargs)

        from application import app

        logging.getLogger('').setLevel(logging.DEBUG)
        logging.getLogger('application').setLevel(logging.DEBUG)
        logging.getLogger('werkzeug').setLevel(logging.DEBUG)
        logging.getLogger('eve').setLevel(logging.DEBUG)

        from eve.utils import config
        config.DEBUG = True

        self.app = app
        self.client = app.test_client()
        assert isinstance(self.client, FlaskClient)
コード例 #55
0
ファイル: tests.py プロジェクト: berg/pourover
    def setUp(self):
        super(BusterTestCase, self).setUp()
        # Flask apps testing. See: http://flask.pocoo.org/docs/testing/
        app.config['TESTING'] = True
        app.config['CSRF_ENABLED'] = False
        self.app = app.test_client()

        self.set_response("https://alpha-api.app.net/stream/0/posts", content=FAKE_POST_OBJ_RESP, status_code=200, method="POST")
        self.clear_datastore()

        taskqueue_stub = apiproxy_stub_map.apiproxy.GetStub('taskqueue')
        dircontainingqueuedotyaml = os.path.dirname(os.path.dirname(__file__))
        taskqueue_stub._root_path = dircontainingqueuedotyaml

        self.taskqueue_stub = taskqueue_stub
        self.set_response('http://i1.ytimg.com/vi/ABm7DuBwJd8/hqdefault.jpg?feature=og', content=FAKE_SMALL_IMAGE, method="GET")
        for i in xrange(0, 12):
            for b in xrange(0, 12):
                unique_key = 'test%s_%s' % (i, b)
                unique_key2 = 'test_%s' % (i)
                self.set_response('http://example.com/buster/%s' % (unique_key), content=HTML_PAGE_TEMPLATE_WITH_META % ({'unique_key': unique_key}))
                self.set_response('http://example.com/buster/%s' % (unique_key2), content=HTML_PAGE_TEMPLATE_WITH_META % ({'unique_key': unique_key2}))
コード例 #56
0
    def setUp(self):
        # do the normal setUp
        super(LoginTestCase, self).setUp()

        app.config['TESTING'] = True
        app.config['CSRF_ENABLED'] = False

        # Setup a test view
        @login_required
        def secret():
            """Temporary secret page"""
            return "Shhh! It's a secret!"

        # add the test view
        self.secret = secret
        app.add_url_rule('/secretTest', 'secret', self.secret)

        # redo the test client
        self.app = app.test_client()

        # make the fake users
        self.users = create_test_users()
コード例 #57
0
ファイル: tests.py プロジェクト: CGTAdal/flamenco
 def setUp(self):
     #self.db_fd,
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/server_test.sqlite'
     app.config['TESTING'] = True
     self.app = app.test_client()
     db.create_all()
コード例 #58
0
ファイル: test_app.py プロジェクト: LandRegistry/titles-api
 def setUp(self):
     self.app = app.test_client()
コード例 #59
0
 def setUp(self):
     app.config['WTF_CSRF_ENABLED'] = False
     self.app = app.test_client()
コード例 #60
0
ファイル: testing.py プロジェクト: physion/aker
    def setUp(self):
        from application import app

        app.config['TESTING'] = True
        self.app = app.test_client()