Ejemplo n.º 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")
Ejemplo n.º 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')
Ejemplo n.º 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()),
        )
Ejemplo n.º 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()),
        )
Ejemplo n.º 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()),
        )
Ejemplo n.º 6
0
    def test_search(self):
        query = MagicMock(spec=ResolweQuery)

        with self.assertRaises(NotImplementedError):
            ResolweQuery.search(query)
Ejemplo n.º 7
0
    def test_search(self):
        query = MagicMock(spec=ResolweQuery)

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