Skip to content
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

Add unit tests for coriolis.db.sqlalchemy.* modules #324

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Cristi1324
Copy link
Contributor

This PR add unit tests for coriolis.db.sqlalchemy.* modules

Copy link
Contributor

@Dany9966 Dany9966 left a comment

Choose a reason for hiding this comment

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

First review pass done, mostly LGTM

class DatabaseSqlalchemyApiTestCase(test_base.CoriolisBaseTestCase):

@mock.patch.object(db_session, 'EngineFacade')
def test_get_facede_none(self, mock_EngineFacade):
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: please rename in order to fix typo: test_get_facade_none

mock_EngineFacade.assert_called_once_with(mock.sentinel.connection)

@mock.patch.object(db_session, 'EngineFacade')
def test_get_facede(self, mock_EngineFacade):
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, rename into test_get_facade

)
mock_db_sync.assert_called_once_with(
mock.sentinel.engine,
mock.ANY,
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of passing mock.ANY, let's please mock os.path.abspath, make it return something like "/abspath". Then you can replace this with "/abspath/migrate_repo". Please apply this to all of these test methods

@Cristi1324 Cristi1324 force-pushed the add_db_sqlalchemy_unit_tests branch from 9b4abc6 to 0d2467a Compare July 10, 2024 13:38
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