コード例 #1
0
    def test_search_with_bad_result(self):
        """Bad search results raise an exception."""
        from inspirehep.modules.workflows.tasks.matching import search

        httpretty.register_uri(
            httpretty.GET,
            current_app.config['WORKFLOWS_MATCH_REMOTE_SERVER_URL'],
            body='<html></html>',
        )

        with pytest.raises(ValueError):
            search('035:"oai:arXiv.org:1505.12345"')
コード例 #2
0
    def test_search_without_result(self):
        """Empty search results are handled correctly."""
        from inspirehep.modules.workflows.tasks.matching import search

        httpretty.register_uri(
            httpretty.GET,
            current_app.config['WORKFLOWS_MATCH_REMOTE_SERVER_URL'],
            body='[]',
            content_type='application/json'
        )

        result = search('035:"oai:arXiv.org:1505.12345"')

        self.assertEqual(len(result), 0)