mik-laj commented on a change in pull request #18007:
URL: https://github.com/apache/airflow/pull/18007#discussion_r702141517
##########
File path: tests/providers/neo4j/hooks/test_neo4j.py
##########
@@ -15,51 +15,94 @@
# specific language governing permissions and limitations
# under the License.
#
-import json
import unittest
from unittest import mock
+from parameterized import parameterized
+
from airflow.models import Connection
from airflow.providers.neo4j.hooks.neo4j import Neo4jHook
class TestNeo4jHookConn(unittest.TestCase):
- def setUp(self):
- super().setUp()
- self.neo4j_hook = Neo4jHook()
- self.connection = Connection(
- conn_type='neo4j', login='login', password='password',
host='host', schema='schema'
+ @parameterized.expand(
+ [
+ [dict(), "bolt://host:7687"],
+ [{"bolt_scheme": True}, "bolt://host:7687"],
+ [{"certs_self_signed": True, "bolt_scheme": True},
"bolt+ssc://host:7687"],
+ [{"certs_trusted_ca": True, "bolt_scheme": True},
"bolt+s://host:7687"],
+ ]
+ )
+ def test_get_uri_neo4j_scheme(self, conn_extra, expected_uri):
+ connection = Connection(
+ conn_type='neo4j',
+ login='login',
+ password='password',
+ host='host',
+ schema='schema',
+ extra=conn_extra,
)
- def test_get_uri_neo4j_scheme(self):
Review comment:
Thanks to parameterization, we can write the same tests, but with less
code duplication, which makes it easier to manage.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]