Пример #1
0
 def test_setup_acme_client_success(self, mock_current_app, mock_acme):
     mock_authority = Mock()
     mock_authority.options = '[{"name": "mock_name", "value": "mock_value"}]'
     mock_client = Mock()
     mock_registration = Mock()
     mock_registration.uri = "http://test.com"
     mock_client.register = mock_registration
     mock_client.agree_to_tos = Mock(return_value=True)
     mock_acme.return_value = mock_client
     result_client, result_registration = plugin.setup_acme_client(mock_authority)
     assert result_client
     assert result_registration
Пример #2
0
 def test_setup_acme_client_fail(self):
     mock_authority = Mock()
     mock_authority.options = []
     with self.assertRaises(Exception):
         plugin.setup_acme_client(mock_authority)