示例#1
0
    def test_search_undefined(self):
        resolwe = MagicMock()
        resource = MagicMock(full_search_paramater=None, query_endpoint="endpoint")
        query = ResolweQuery(resolwe, resource)

        # If ``full_search_paramater`` is not defined, raise NotImplemented error.
        with self.assertRaises(NotImplementedError):
            query.search("foo bar")
示例#2
0
    def test_search_undefined(self):
        resolwe = MagicMock()
        resource = MagicMock(full_search_paramater=None, query_endpoint='endpoint')
        query = ResolweQuery(resolwe, resource)

        # If ``full_search_paramater`` is not defined, raise NotImplemented error.
        with self.assertRaises(NotImplementedError):
            query.search('foo bar')
示例#3
0
    def test_search(self):
        resolwe = MagicMock()
        resource = MagicMock(full_search_paramater='text', query_endpoint='endpoint',
                             query_method='GET')
        query = ResolweQuery(resolwe, resource)

        new_query = query.search('foobar')
        self.assertEqual(
            list(new_query._filters.items()),
            list({'text': ['foobar']}.items()),
        )
示例#4
0
    def test_search(self):
        resolwe = MagicMock()
        resource = MagicMock(full_search_paramater='text',
                             query_endpoint='endpoint',
                             query_method='GET')
        query = ResolweQuery(resolwe, resource)

        new_query = query.search('foobar')
        self.assertEqual(
            list(new_query._filters.items()),
            list({'text': ['foobar']}.items()),
        )
示例#5
0
    def test_search(self):
        resolwe = MagicMock()
        resource = MagicMock(
            full_search_paramater="text", query_endpoint="endpoint", query_method="GET"
        )
        query = ResolweQuery(resolwe, resource)

        new_query = query.search("foobar")
        self.assertEqual(
            list(new_query._filters.items()),
            list({"text": ["foobar"]}.items()),
        )
示例#6
0
    def test_search(self):
        query = MagicMock(spec=ResolweQuery)

        with self.assertRaises(NotImplementedError):
            ResolweQuery.search(query)
    def test_search(self):
        query = MagicMock(spec=ResolweQuery)

        with self.assertRaises(NotImplementedError):
            ResolweQuery.search(query)