Beispiel #1
0
    def test_invalid_input_exception(self):
        # create a client with TESTING=False so we get error responses
        self.app = create_app(**{'TESTING': False})
        self.app.register_blueprint(pipeline_bp)
        self.client = self.app.test_client()

        headers = [('Content-Type', 'application/json')]
        resp = self.client.post('/pipelines/example', data=json.dumps({
            # munge the data to incorrect form (dict instead of a list)
            'data': {'foobar': ['AA', 'BB']}
        }), headers=headers)
        self.assertEquals(resp.status_code, 500)

        expected = {
            'type': str,
            'message': str,
            'data': dict
        }
        resp_json = json.loads(resp.data.decode('utf-8'))
        for k, t in expected.items():
            self.assertTrue(isinstance(resp_json[k], t))
Beispiel #2
0
 def setUp(self):
     self.app = create_app(**test_config)
     self.app.register_blueprint(pipeline_bp)
     self.client = self.app.test_client()
Beispiel #3
0
 def create_app(self, **app_config):
     self.app = create_app(**app_config)
     self.app.register_blueprint(self.pipeline_bp)
     for bp in self.blueprints:
         self.app.register_blueprint(bp)
     return self.app