Exemplo n.º 1
0
 def test_configure_vault_msql(self, configure_vault):
     mysql = mock.MagicMock()
     mysql.allowed_units.return_value = ['vault/0']
     self.local_unit.return_value = 'vault/0'
     handlers.configure_vault_mysql(mysql)
     configure_vault.assert_called_once_with({
         'storage_name': 'mysql',
         'mysql_db_relation': mysql
     })
 def test_configure_vault_msql_tls(self, configure_vault, write_file,
                                   base64):
     _cert = "Certificate Authority"
     mysql = mock.MagicMock()
     mysql.ssl_ca.return_value = _cert
     mysql.allowed_units.return_value = ['vault/0']
     self.local_unit.return_value = 'vault/0'
     _base64encoded = "Base64 Encoded"
     base64.decodebytes.return_value = _base64encoded
     handlers.configure_vault_mysql(mysql)
     write_file.assert_called_once_with(
         "/var/snap/vault/common/db-tls-ca.pem",
         _base64encoded,
         perms=0o600)
     configure_vault.assert_called_once_with({
         'storage_name':
         'mysql',
         'mysql_db_relation':
         mysql,
         'tls_ca_file':
         '/var/snap/vault/common/db-tls-ca.pem'
     })
Exemplo n.º 3
0
 def test_configure_vault_msql_noacl(self, configure_vault):
     mysql = mock.MagicMock()
     mysql.allowed_units.return_value = ['vault/1']
     self.local_unit.return_value = 'vault/0'
     handlers.configure_vault_mysql(mysql)
     configure_vault.assert_not_called()