def test_add_remove(self): user = UserFactory() context = ExecutionContext(user=user, plugin=self.plugin_info['1']['plugin']) manager = PluginManager(context) # This should be 1 because we have just added a plugin for the user. plugin_key = self.plugin_info['1']['plugin'].hashkey manager.add(plugin_key) self.assertEqual(len(user.plugins), 1) manager.remove(plugin_key) self.assertEqual(len(user.plugins), 0)