Skip to content

Commit

Permalink
reorganise new DB tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Reillyhewitson committed Nov 22, 2022
1 parent aa39a81 commit 7ffc4b8
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/integration/datagateway_api/db/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
INVESTIGATION,
INVESTIGATIONINSTRUMENT,
)
from test.datagateway_api.db.endpoints.test_create_db import TestDBCreateData
from test.integration.datagateway_api.db.endpoints.test_create_db import (
TestDBCreateData,
)


def set_meta_attributes(entity):
Expand Down
50 changes: 50 additions & 0 deletions test/integration/datagateway_api/db/endpoints/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from icat.query import Query
import pytest


@pytest.fixture()
def icat_query(icat_client):
return Query(icat_client, "Investigation")


@pytest.fixture()
def bad_credentials_header():
return {"Authorization": "Bearer Invalid"}


@pytest.fixture()
def invalid_credentials_header():
return {"Authorization": "Test"}


@pytest.fixture()
def test_config_data():
return {
"datagateway_api": {
"extension": "/datagateway-api",
"backend": "db",
"client_cache_size": 5,
"client_pool_init_size": 2,
"client_pool_max_size": 5,
"db_url": "mysql+pymysql://icatdbuser:icatdbuserpw@localhost:3306/icatdb",
"icat_url": "https://localhost:8181",
"icat_check_cert": False,
},
"search_api": {
"extension": "/search-api",
"icat_url": "https://localhost.testdomain:8181",
"icat_check_cert": True,
"mechanism": "anon",
"username": "",
"password": "",
},
"flask_reloader": False,
"log_level": "WARN",
"log_location": "/home/runner/work/datagateway-api/datagateway-api/logs.log",
"debug_mode": False,
"generate_swagger": False,
"host": "127.0.0.1",
"port": "5000",
"test_user_credentials": {"username": "root", "password": "pw"},
"test_mechanism": "simple",
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
DatabaseWhereFilter,
)
from datagateway_api.src.datagateway_api.database.helpers import ReadQuery
from test.datagateway_api.db.endpoints.test_create_db import (
from test.integration.datagateway_api.db.endpoints.test_create_db import (
prepare_db_data_for_assertion,
)

Expand Down

0 comments on commit 7ffc4b8

Please sign in to comment.