You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/08 09:46:56 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #13250: Fix link to Apache Airflow docs in webserver

mik-laj commented on a change in pull request #13250:
URL: https://github.com/apache/airflow/pull/13250#discussion_r553842692



##########
File path: tests/utils/test_docs.py
##########
@@ -34,14 +35,20 @@ class TestGetDocsUrl(unittest.TestCase):
             ),
             (
                 '2.0.0.dev0',
-                'migration.html',
+                'tutorial.html',
                 'http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/'
-                'apache-airflow/latest/migration.html',
+                'apache-airflow/latest/tutorial.html',
+            ),
+            ('1.10.10', None, 'https://airflow.apache.org/docs/apache-airflow/1.10.10/'),
+            (
+                '1.10.10',
+                'tutorial.html',
+                'https://airflow.apache.org/docs/apache-airflow/1.10.10/tutorial.html',
             ),
-            ('1.10.0', None, 'https://airflow.apache.org/docs/1.10.0/'),
-            ('1.10.0', 'migration.html', 'https://airflow.apache.org/docs/1.10.0/migration.html'),
         ]
     )
-    def test_should_return_link(self, version, page, expected_urk):
+    def test_should_return_link(self, version, page, expected_url):
         with mock.patch('airflow.version.version', version):
-            self.assertEqual(expected_urk, get_docs_url(page))
+            self.assertEqual(expected_url, get_docs_url(page))
+            resp = requests.get(expected_url)
+            assert resp.status_code == 200

Review comment:
       It seems fine in this case, but we can speed up this code a bit if we use HEAD requests.

##########
File path: tests/utils/test_docs.py
##########
@@ -34,14 +35,20 @@ class TestGetDocsUrl(unittest.TestCase):
             ),
             (
                 '2.0.0.dev0',
-                'migration.html',
+                'tutorial.html',
                 'http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/'
-                'apache-airflow/latest/migration.html',
+                'apache-airflow/latest/tutorial.html',
+            ),
+            ('1.10.10', None, 'https://airflow.apache.org/docs/apache-airflow/1.10.10/'),
+            (
+                '1.10.10',
+                'tutorial.html',
+                'https://airflow.apache.org/docs/apache-airflow/1.10.10/tutorial.html',
             ),
-            ('1.10.0', None, 'https://airflow.apache.org/docs/1.10.0/'),
-            ('1.10.0', 'migration.html', 'https://airflow.apache.org/docs/1.10.0/migration.html'),
         ]
     )
-    def test_should_return_link(self, version, page, expected_urk):
+    def test_should_return_link(self, version, page, expected_url):
         with mock.patch('airflow.version.version', version):
-            self.assertEqual(expected_urk, get_docs_url(page))
+            self.assertEqual(expected_url, get_docs_url(page))
+            resp = requests.get(expected_url)

Review comment:
       ```suggestion
               resp = requests.head(expected_url)
   ```




----------------------------------------------------------------
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:
users@infra.apache.org