ashb commented on a change in pull request #12694:
URL: https://github.com/apache/airflow/pull/12694#discussion_r532118346



##########
File path: tests/www/test_views.py
##########
@@ -349,45 +346,22 @@ def test_should_list_plugins_on_page_with_details(self):
         self.check_content_in_response("source", resp)
         
self.check_content_in_response("<em>$PLUGINS_FOLDER/</em>test_plugin.py", resp)
 
-    @mock.patch('airflow.plugins_manager.pkg_resources.iter_entry_points')
-    def test_should_list_entrypoint_plugins_on_page_with_details(self, 
mock_ep_plugins):
-        from airflow.plugins_manager import load_entrypoint_plugins
-
-        mock_entrypoint = mock.Mock()
-        mock_entrypoint.name = 'test-entrypoint-testpluginview'
-        mock_entrypoint.module_name = 'module_name_testpluginview'
-        mock_entrypoint.dist = 'test-entrypoint-testpluginview==1.0.0'
-        mock_entrypoint.load.return_value = EntrypointPlugin
-        mock_ep_plugins.return_value = [mock_entrypoint]
+    def test_should_list_entrypoint_plugins_on_page_with_details(self):
 
-        load_entrypoint_plugins()
-        resp = self.client.get('/plugin')
+        mock_plugin = AirflowPlugin()
+        mock_plugin.name = "test_plugin"
+        mock_plugin.source = EntryPointSource(
+            mock.Mock(), mock.Mock(version='1.0.0', metadata={'name': 
'test-entrypoint-testpluginview'})
+        )
+        with mock_plugin_manager(plugins=[mock_plugin]):
+            resp = self.client.get('/plugin')
 
         self.check_content_in_response("test_plugin", resp)
         self.check_content_in_response("Airflow Plugins", resp)
         self.check_content_in_response("source", resp)
         
self.check_content_in_response("<em>test-entrypoint-testpluginview==1.0.0:</em> 
<Mock id=", resp)
 
 
-class TestPluginsDirectorySource(unittest.TestCase):
-    def test_should_provide_correct_attribute_values(self):
-        source = PluginsDirectorySource("./test_views.py")
-        self.assertEqual("$PLUGINS_FOLDER/../../test_views.py", str(source))
-        self.assertEqual("<em>$PLUGINS_FOLDER/</em>../../test_views.py", 
source.__html__())
-        self.assertEqual("../../test_views.py", source.path)
-
-
-class TestEntryPointSource(unittest.TestCase):
-    def test_should_provide_correct_attribute_values(self):
-        mock_entrypoint = mock.Mock()
-        mock_entrypoint.dist = 'test-entrypoint-dist==1.0.0'
-        source = EntryPointSource(mock_entrypoint)
-        self.assertEqual("test-entrypoint-dist==1.0.0", source.dist)
-        self.assertEqual(str(mock_entrypoint), source.entrypoint)
-        self.assertEqual("test-entrypoint-dist==1.0.0: " + 
str(mock_entrypoint), str(source))
-        self.assertEqual("<em>test-entrypoint-dist==1.0.0:</em> " + 
str(mock_entrypoint), source.__html__())
-
-

Review comment:
       These were duplicating tests in test_plugins_manager.py -- they don't 
belong here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to