Skip to content

Conversation

@odesenfans
Copy link
Collaborator

Added a fixture to initialize the database. This fixture initializes
the collections used by a CCN in a separate database and resets
it on every run.

This feature will allow to write more extensive tests by preloading
fixture data in the DB.

Implemented a first test using the fixture for the pending TX job.
On the CI side, we now spawn a service container to run MongoDB.

Copy link
Member

@hoh hoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good !
A small note on filepath that could be simplified.

Comment on lines 13 to 14
fixtures_dir = os.path.join(os.path.dirname(__file__), "fixtures")
with open(os.path.join(fixtures_dir, fixture)) as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified using filepath.Path.

Suggested change
fixtures_dir = os.path.join(os.path.dirname(__file__), "fixtures")
with open(os.path.join(fixtures_dir, fixture)) as f:
messages_path = Path(__file__).parent / "fixtures" / fixture
with open(messages_path) as f:

Added a fixture to initialize the database. This fixture initializes
the collections used by a CCN in a separate database and resets
it on every run.

This feature will allow to write more extensive tests by preloading
fixture data in the DB.

Implemented a first test using the fixture for the pending TX job.
On the CI side, we now spawn a service container to run MongoDB.
@odesenfans odesenfans force-pushed the od-unit-tests-with-db branch from 172240b to 400b674 Compare April 26, 2022 10:18
@odesenfans odesenfans merged commit c4d306e into aleph-im:dev Apr 26, 2022
@odesenfans odesenfans deleted the od-unit-tests-with-db branch April 26, 2022 10:24
odesenfans added a commit that referenced this pull request Apr 27, 2022
Added a fixture to initialize the database. This fixture initializes
the collections used by a CCN in a separate database and resets
it on every run.

This feature will allow to write more extensive tests by preloading
fixture data in the DB.

Implemented a first test using the fixture for the pending TX job.
On the CI side, we now spawn a service container to run MongoDB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants