from __future__ import unicode_literals, division, absolute_import
from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin

from flexget import plugin


class TestInterfaces(object):
    """Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""
    def test_task_interface(self):
        plugin.load_plugins()
        task_plugins = plugin.get_plugins(interface='task')
        for p in task_plugins:
            assert isinstance(p.schema, dict), 'Task interface requires a schema to be defined.'
            assert p.phase_handlers, 'Task plugins should have at least on phase handler (on_task_X) method.'


    def test_list_interface(self):
        plugin.load_plugins()
        task_plugins = plugin.get_plugins(interface='list')
        for p in task_plugins:
            assert isinstance(p.schema, dict), 'List interface requires a schema to be defined.'
            assert hasattr(p.instance, 'get_list'), 'List plugins must implement a get_list method.'

from __future__ import unicode_literals, division, absolute_import
from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin

from flexget import plugin


class TestInterfaces(object):
    """Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""
    def get_plugins(self, interface):
        plugins = list(plugin.get_plugins(interface=interface))
        assert plugins, 'No plugins for this interface found.'
        return plugins

    def test_task_interface(self):
        for p in self.get_plugins('task'):
            assert isinstance(p.schema, dict), 'Task interface requires a schema to be defined.'
            assert p.phase_handlers, 'Task plugins should have at least on phase handler (on_task_X) method.'

    def test_list_interface(self):
        for p in self.get_plugins('list'):
            assert isinstance(p.schema, dict), 'List interface requires a schema to be defined.'
            assert hasattr(p.instance, 'get_list'), 'List plugins must implement a get_list method.'

    def test_search_interface(self):
        for p in self.get_plugins('search'):
            assert isinstance(p.schema, dict), 'Search interface requires a schema to be defined.'
            assert hasattr(p.instance, 'search'), 'Search plugins must implement a search method.'

Add tests for search interface plugins
Add tests for search interface plugins

  from __future__ import unicode_literals, division, absolute_import
  from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin
  
  from flexget import plugin
  
  
  class TestInterfaces(object):
      """Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""
+     def get_plugins(self, interface):
+         plugins = list(plugin.get_plugins(interface=interface))
+         assert plugins, 'No plugins for this interface found.'
+         return plugins
+ 
      def test_task_interface(self):
-         plugin.load_plugins()
-         task_plugins = plugin.get_plugins(interface='task')
-         for p in task_plugins:
+         for p in self.get_plugins('task'):
              assert isinstance(p.schema, dict), 'Task interface requires a schema to be defined.'
              assert p.phase_handlers, 'Task plugins should have at least on phase handler (on_task_X) method.'
  
- 
      def test_list_interface(self):
-         plugin.load_plugins()
-         task_plugins = plugin.get_plugins(interface='list')
-         for p in task_plugins:
+         for p in self.get_plugins('list'):
              assert isinstance(p.schema, dict), 'List interface requires a schema to be defined.'
              assert hasattr(p.instance, 'get_list'), 'List plugins must implement a get_list method.'
  
+     def test_search_interface(self):
+         for p in self.get_plugins('search'):
+             assert isinstance(p.schema, dict), 'Search interface requires a schema to be defined.'
+             assert hasattr(p.instance, 'search'), 'Search plugins must implement a search method.'
+ 
Add tests for search interface plugins
## Code Before:
from __future__ import unicode_literals, division, absolute_import
from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin

from flexget import plugin


class TestInterfaces(object):
    """Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""
    def test_task_interface(self):
        plugin.load_plugins()
        task_plugins = plugin.get_plugins(interface='task')
        for p in task_plugins:
            assert isinstance(p.schema, dict), 'Task interface requires a schema to be defined.'
            assert p.phase_handlers, 'Task plugins should have at least on phase handler (on_task_X) method.'


    def test_list_interface(self):
        plugin.load_plugins()
        task_plugins = plugin.get_plugins(interface='list')
        for p in task_plugins:
            assert isinstance(p.schema, dict), 'List interface requires a schema to be defined.'
            assert hasattr(p.instance, 'get_list'), 'List plugins must implement a get_list method.'

## Instruction:
Add tests for search interface plugins
## Code After:
from __future__ import unicode_literals, division, absolute_import
from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin

from flexget import plugin


class TestInterfaces(object):
    """Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""
    def get_plugins(self, interface):
        plugins = list(plugin.get_plugins(interface=interface))
        assert plugins, 'No plugins for this interface found.'
        return plugins

    def test_task_interface(self):
        for p in self.get_plugins('task'):
            assert isinstance(p.schema, dict), 'Task interface requires a schema to be defined.'
            assert p.phase_handlers, 'Task plugins should have at least on phase handler (on_task_X) method.'

    def test_list_interface(self):
        for p in self.get_plugins('list'):
            assert isinstance(p.schema, dict), 'List interface requires a schema to be defined.'
            assert hasattr(p.instance, 'get_list'), 'List plugins must implement a get_list method.'

    def test_search_interface(self):
        for p in self.get_plugins('search'):
            assert isinstance(p.schema, dict), 'Search interface requires a schema to be defined.'
            assert hasattr(p.instance, 'search'), 'Search plugins must implement a search method.'
