-
Notifications
You must be signed in to change notification settings - Fork 1
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
SFR-2481/save_test_data #543
Conversation
def save_test_data_ids_to_file(self): | ||
record = self.db_manager.session.query(Record).filter_by(source_id=self.test_data['source_id']).first() | ||
if record: | ||
with open('test_data_ids.json', 'w') as f: | ||
json.dump({ | ||
'edition_id': str(record.edition_id), | ||
'uuid': str(record.uuid) | ||
}, f) |
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.
I like this idea to share the test ids with the tests but I think we should use fixtures to seed the data instead of the process!
@pytest.fixture(scope="module", autouse=True) | ||
def seed_test_data(): | ||
process = SeedTestDataProcess() | ||
process.runProcess() |
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.
I think we can use seed the data directly from fixtures. Let's move this to conftest.py.
@pytest.mark.parametrize("endpoint, expected_status", [ | ||
("/editions/1982731", 200), | ||
("/editions/{SEEDED_EDITION_ID}", 200), |
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.
Is there a way to grab the edition from a fixture after it's been seeded and use it here in the parametrize annotation?
test_data_ids.json
Outdated
@@ -0,0 +1 @@ | |||
{"edition_id": "19855", "uuid": "3264ccb1-a870-43d7-9496-2153ca99acc6"} |
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.
let's get rid of this file!
@@ -16,3 +25,64 @@ def setup_env(pytestconfig, request): | |||
|
|||
if not running_unit_tests and environment in ['local', 'qa']: | |||
load_env_file(environment, file_string=f'config/{environment}.yaml') | |||
|
|||
@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.
question on the module scope. does this run during the unit tests?
we just want to run it during functional and integration tests
@@ -1,17 +1,19 @@ | |||
import pytest | |||
import requests | |||
import json | |||
from .constants import API_URL |
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.
Ok so the API_URL will have to change depending in the env. I think we can get this from the config file - DRB_API_HOST
} | ||
|
||
@pytest.fixture(scope='module') | ||
def seeded_edition_id(request, seed_test_data): |
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.
You may want to double check but I think because we have seed_test_data here it'll automatically make sure seed_test_data is resolved. Thus, checking the request may not make sense.
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.
We may run into some issues on CI but let's see how we do!
@ayan1229 let's get this out the door and make sure the tests are passing in CI. I'd get started on adding the other tests to CI as well. |
No description provided.