Refactor and add tests for plugins.py

Improvement to the tests currently being run on ``plugins.py``

related #644 
Can you move the description of how the test works to the docstring? Having the comments here make the code difficult to read.