def test_get_db_url(self, mock_context, mock_config):
     mock_db_context = MagicMock()
     mock_db_context.return_value = {
         'database_type': 'pymysql+mysql',
         'database_user': '******',
         'database_host': 'testhost',
         'database_password': '******',
         'database': 'testdatabase',
     }
     mock_context.SharedDBContext.return_value = mock_db_context
     self.assertEqual(
         nutils.get_db_url(),
         "pymysql+mysql://testuser:testpassword@testhost/testdatabase")
 def test_get_db_url(self,
                     mock_context,
                     mock_config):
     mock_db_context = MagicMock()
     mock_db_context.return_value = {
         'database_type': 'pymysql+mysql',
         'database_user': '******',
         'database_host': 'testhost',
         'database_password': '******',
         'database': 'testdatabase',
     }
     mock_context.SharedDBContext.return_value = mock_db_context
     self.assertEqual(
         nutils.get_db_url(),
         "pymysql+mysql://testuser:testpassword@testhost/testdatabase"
     )
 def test_get_db_url_ssl(self, mock_context, mock_config):
     mock_db_context = MagicMock()
     mock_db_context.return_value = {
         'database_type': 'pymysql+mysql',
         'database_user': '******',
         'database_host': 'testhost',
         'database_password': '******',
         'database': 'testdatabase',
         'database_ssl_ca': 'foo',
         'database_ssl_cert': 'bar',
         'database_ssl_key': 'baz',
     }
     mock_context.SharedDBContext.return_value = mock_db_context
     self.assertEqual(
         nutils.get_db_url(),
         "pymysql+mysql://testuser:testpassword@testhost/testdatabase"
         "?ssl_ca=foo&ssl_cert=bar&ssl_key=baz")
 def test_get_db_url_ssl(self,
                         mock_context,
                         mock_config):
     mock_db_context = MagicMock()
     mock_db_context.return_value = {
         'database_type': 'pymysql+mysql',
         'database_user': '******',
         'database_host': 'testhost',
         'database_password': '******',
         'database': 'testdatabase',
         'database_ssl_ca': 'foo',
         'database_ssl_cert': 'bar',
         'database_ssl_key': 'baz',
     }
     mock_context.SharedDBContext.return_value = mock_db_context
     self.assertEqual(
         nutils.get_db_url(),
         "pymysql+mysql://testuser:testpassword@testhost/testdatabase"
         "?ssl_ca=foo&ssl_cert=bar&ssl_key=baz"
     )