コード例 #1
0
ファイル: test_repo.py プロジェクト: omh/yoshimi
    def test_query(self, query_class):
        session = Mock()
        registry = Mock()
        query_extension = Mock(autospec=_QueryExtensions)
        query_extension.methods = {}
        registry.queryUtility.return_value = query_extension
        repo = Repo(registry, session)
        subject = Mock()

        rv = repo.query(subject)

        assert isinstance(rv, Query)
        query_class.assert_called_once_with(session, subject, {})
コード例 #2
0
ファイル: test_repo.py プロジェクト: omh/yoshimi
    def test_query(self, query_class):
        session = Mock()
        registry = Mock()
        query_extension = Mock(autospec=_QueryExtensions)
        query_extension.methods = {}
        registry.queryUtility.return_value = query_extension
        repo = Repo(registry, session)
        subject = Mock()

        rv = repo.query(subject)

        assert isinstance(rv, Query)
        query_class.assert_called_once_with(session, subject, {})
コード例 #3
0
ファイル: test_repo.py プロジェクト: omh/yoshimi
def get_repo_mock(registry=None, session=None, query_extensions=None):
    if not session:
        session = Mock()
    if not registry:
        registry = Mock()
    if not query_extensions:
        query_extensions = {}

    query_extension = Mock(autospec=_QueryExtensions)
    query_extension.methods = query_extensions
    registry.queryUtility.return_value = query_extension
    repo = Repo(registry, session)

    return repo
コード例 #4
0
ファイル: test_repo.py プロジェクト: omh/yoshimi
def get_repo_mock(registry=None, session=None, query_extensions=None):
    if not session:
        session = Mock()
    if not registry:
        registry = Mock()
    if not query_extensions:
        query_extensions = {}

    query_extension = Mock(autospec=_QueryExtensions)
    query_extension.methods = query_extensions
    registry.queryUtility.return_value = query_extension
    repo = Repo(registry, session)

    return repo