def setUp(self):
        from mme_server.server import app

        self.client = app.test_client()
        self.data = json.dumps(EXAMPLE_REQUEST)
        self.accept_header = ('Accept', 'application/vnd.ga4gh.matchmaker.v1.0+json')
        self.content_type_header = ('Content-Type', 'application/json')
        self.headers = [self.accept_header, self.content_type_header]
示例#2
0
 def test_query(self):
     from mme_server.server import app
     self.client = app.test_client()
     self.data = json.dumps(EXAMPLE_REQUEST)
     response = self.client.post('/v1/match', data=self.data, headers=self.headers)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.headers['Content-Type'], 'application/vnd.ga4gh.matchmaker.v1.0+json')
     response_data = json.loads(response.get_data(as_text=True))
     validate_response(response_data)
     self.assertEqual(len(response_data['results']), 5)
    def test_query(self):
        from mme_server.server import app
        self.client = app.test_client()
        self.data = json.dumps(EXAMPLE_REQUEST)
        self.accept_header = ('Accept', 'application/vnd.ga4gh.matchmaker.v1.0+json')
        self.content_type_header = ('Content-Type', 'application/json')
        self.headers = [self.accept_header, self.content_type_header]

        response = self.client.post('/match', data=self.data, headers=self.headers)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.headers['Content-Type'], 'application/vnd.ga4gh.matchmaker.v1.0+json')
        response_data = json.loads(response.get_data(as_text=True))
        validate_response(response_data)
        self.assertEqual(len(response_data['results']), 5)
示例#4
0
    def setUp(self):
        from mme_server.server import app
        from mme_server.cli import add_server

        self.client = app.test_client()
        self.data = json.dumps(EXAMPLE_REQUEST)
        self.auth_token = 'mysecretauthtoken'
        self.test_server_id = 'test_server_{}'.format(randint(0, 1000000))
        add_server(self.test_server_id, 'in', key=self.auth_token)

        self.accept_header = ('Accept', 'application/vnd.ga4gh.matchmaker.v1.0+json')
        self.content_type_header = ('Content-Type', 'application/json')
        self.auth_token_header = ('X-Auth-Token', self.auth_token)
        self.headers = [
            self.accept_header,
            self.content_type_header,
            self.auth_token_header,
        ]