-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UIP-49 - separate Integration vs unit tests in test script #98
Conversation
Sigh, GitHub didn't update the PR target after merging the previous PR. So the appinfo changes are back again! The actual unreviewed changes are in the latest 3 commits. |
@@ -13,7 +13,8 @@ | |||
from lib.installed_clients.FakeObjectsForTestsClient import FakeObjectsForTests | |||
from lib.installed_clients.WorkspaceClient import Workspace | |||
|
|||
@pytest.fixture(scope="session") | |||
|
|||
@pytest.fixture(scope="module") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scope this to the module, in case any tests make changes to the config (like the sharemanager tests...)
@@ -2,11 +2,26 @@ | |||
current_dir=$(dirname "$(readlink -f "$0")") | |||
script_dir=$(dirname "$(readlink -f "$0")") | |||
export KB_DEPLOYMENT_CONFIG="$current_dir"/deploy.cfg | |||
export KB_AUTH_TOKEN=`cat /kb/module/work/token` | |||
if [ -f /kb/module/work/token ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was failing in local unit tests, so I put in a test for that file and a little log message about using it.
@@ -46,23 +47,26 @@ def test_invalid_share_level(config: dict[str, str]): | |||
@mock.patch("NarrativeService.sharing.sharemanager.feeds") | |||
@mock.patch("NarrativeService.sharing.sharemanager.ws.get_ws_admins", return_value=FAKE_ADMINS) | |||
def test_make_notification_ok(mock_ws, mock_post, config: dict[str, str]): # noqa: ARG001 | |||
config["service-token"] = "fake-service-token" | |||
config["ws-admin-token"] = "fake-admin-token" | |||
for key in REQUIRED_TOKEN_KEYS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the keys are set as expected for each test. These modify the config dictionary, which persists throughout the module.
…nged to module scope as well
The
test/run_tests.sh
script now knows the difference between integration and unit tests.If run just plain as
sh test/run_tests.sh
, it just runs the unit tests.If run as
sh test/run_tests.sh integration
in includes integration tests.It also includes integration tests if the
SDK_CALLBACK_URL
environment variable is present, which primarily gets set during akb-sdk test
run. So those should always run the whole suite... which is the point, there.This also moves the remaining test files to the integration directory. They're unchanged, except for relative imports in two cases, and the file names were changed.