def test_app_static(self): app.testing = True self.app = app.test_client() respStatusCode = 200 resp = self.app.get('/index.html') assert resp.status_code == respStatusCode
def test_app_responding(self): app.testing = True self.app = app.test_client() respStatusCode = 200 resp = self.app.get('/') assert resp.status_code == respStatusCode
def test_getActiniaCore(self): app.testing = True self.app = app.test_client() respStatusCode = 200 resp = self.app.get('/processes/test/jobs') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_Connection_post(self): app.testing = True self.app = app.test_client() respStatusCode = 200 resp = self.app.post('/processes/test/connection') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_GetResources(self): app.testing = True self.app = app.test_client() respStatusCode = 405 resp = self.app.get('/resources/processes/operations/update') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_swagger(self): app.testing = True self.app = app.test_client() resp = self.app.get('/latest/api/swagger.json') respData = json.loads(resp.get_data(as_text=True)) assert type(resp) is Response assert type(respData) == dict assert respData["info"]["title"] == 'actinia-gdi'
def test_RawCategory(self): app.testing = True self.app = app.test_client() respStatusCode = 200 resp = self.app.get('/metadata/raw/categories/mfg') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_RawTag(self): app.testing = True self.app = app.test_client() respStatusCode = 200 resp = self.app.get('/metadata/raw/tags/Eurasia') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_Uuid(self): app.testing = True self.app = app.test_client() respStatusCode = 200 resp = self.app.get('/metadata/geodata/uuids/da165110-88fd-11da-a88f-000d939bc5d8') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_Connection_get(self): app.testing = True self.app = app.test_client() respStatusCode = 200 # respData = '{"status": "success"}' resp = self.app.get('/metadata/test/connection') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_RawUuid(self): app.testing = True self.app = app.test_client() respStatusCode = 200 testUuid = 'da165110-88fd-11da-a88f-000d939bc5d8' resp = self.app.get('/metadata/raw/uuids/' + testUuid) assert type(resp) is Response assert resp.status_code == respStatusCode
def test_app_running(self): # from http://flask.pocoo.org/docs/0.12/api/#flask.Flask.test_client: # Note that if you are testing for assertions or exceptions in your # application code, you must set app.testing = True in order for the # exceptions to propagate to the test client. Otherwise, the exception # will be handled by the application (not visible to the test client) # and the only indication of an AssertionError or other exception will # be a 500 status code response to the test client. app.testing = True self.app = app.test_client() resp = self.app.get('/') assert type(resp) is Response
def test_postActiniaCoreFailure(self): app.testing = True self.app = app.test_client() respStatusCode = 500 with open('tests/resources/postbody.processes.failure.json') as file: postBody = json.load(file) resp = self.app.post('/processes/test/jobs', data=json.dumps(postBody), content_type='application/json') assert type(resp) is Response assert resp.status_code == respStatusCode
def test_PostResources(self): app.testing = True self.app = app.test_client() respStatusCode = 200 # TODO: example actinia-core-response is gone! with open('tests/resources/actinia-core-resp.json') as jsonfile: postBody = json.load(jsonfile) resp = self.app.post('/resources/processes/operations/update', data=str(json.dumps(postBody)), content_type='application/json') assert type(resp) is Response assert resp.status_code == respStatusCode