from JsonStats.FetchStats.Plugins import *

from . import TestCase

import JsonStats.FetchStats.Plugins
from JsonStats.FetchStats import Fetcher


class TestPluginMount(TestCase):

    def setUp(self):
        # Do stuff that has to happen on every test in this instance
        self.fetcher = Fetcher

    def test_get_plugins(self):
        """
        Verify that after loading plugins we can see them attached to
        the Mount.
        """
        discovered = len(self.fetcher.get_plugins())
        expected = len(JsonStats.FetchStats.Plugins.__all__)
        self.assertEqual(discovered, expected)

from . import TestCase

import JsonStats.FetchStats.Plugins
from JsonStats.FetchStats import Fetcher


class TestPluginMount(TestCase):

    def setUp(self):
        # Do stuff that has to happen on every test in this instance
        self.fetcher = Fetcher

        class _example_plugin(Fetcher):
            def __init__(self):
                self.context = 'testplugin'
                self._load_data()
            def _load_data(self):
                self._loaded(True)
            def dump(self):
                return {}
            def dump_json(self):
                return self.json.dumps(self.dump())

        self.example_plugin = _example_plugin


    def test_get_plugins(self):
        """
        Verify that after loading plugins we can see them attached to
        the Mount.
        """
        example_plugin = self.example_plugin()
        discovered = len(self.fetcher.get_plugins())
        assert discovered == 1

Fix the plugin mount text. And make it way more intelligent.
Fix the plugin mount text. And make it way more intelligent.

- from JsonStats.FetchStats.Plugins import *
- 
  from . import TestCase
  
  import JsonStats.FetchStats.Plugins
  from JsonStats.FetchStats import Fetcher
  
  
  class TestPluginMount(TestCase):
  
      def setUp(self):
          # Do stuff that has to happen on every test in this instance
          self.fetcher = Fetcher
  
+         class _example_plugin(Fetcher):
+             def __init__(self):
+                 self.context = 'testplugin'
+                 self._load_data()
+             def _load_data(self):
+                 self._loaded(True)
+             def dump(self):
+                 return {}
+             def dump_json(self):
+                 return self.json.dumps(self.dump())
+ 
+         self.example_plugin = _example_plugin
+ 
+ 
      def test_get_plugins(self):
          """
          Verify that after loading plugins we can see them attached to
          the Mount.
          """
+         example_plugin = self.example_plugin()
          discovered = len(self.fetcher.get_plugins())
+         assert discovered == 1
-         expected = len(JsonStats.FetchStats.Plugins.__all__)
-         self.assertEqual(discovered, expected)
  
Fix the plugin mount text. And make it way more intelligent.
## Code Before:
from JsonStats.FetchStats.Plugins import *

from . import TestCase

import JsonStats.FetchStats.Plugins
from JsonStats.FetchStats import Fetcher


class TestPluginMount(TestCase):

    def setUp(self):
        # Do stuff that has to happen on every test in this instance
        self.fetcher = Fetcher

    def test_get_plugins(self):
        """
        Verify that after loading plugins we can see them attached to
        the Mount.
        """
        discovered = len(self.fetcher.get_plugins())
        expected = len(JsonStats.FetchStats.Plugins.__all__)
        self.assertEqual(discovered, expected)

## Instruction:
Fix the plugin mount text. And make it way more intelligent.
## Code After:
from . import TestCase

import JsonStats.FetchStats.Plugins
from JsonStats.FetchStats import Fetcher


class TestPluginMount(TestCase):

    def setUp(self):
        # Do stuff that has to happen on every test in this instance
        self.fetcher = Fetcher

        class _example_plugin(Fetcher):
            def __init__(self):
                self.context = 'testplugin'
                self._load_data()
            def _load_data(self):
                self._loaded(True)
            def dump(self):
                return {}
            def dump_json(self):
                return self.json.dumps(self.dump())

        self.example_plugin = _example_plugin


    def test_get_plugins(self):
        """
        Verify that after loading plugins we can see them attached to
        the Mount.
        """
        example_plugin = self.example_plugin()
        discovered = len(self.fetcher.get_plugins())
        assert discovered == 1
