Exemplo n.º 1
0
    def test_delete_domain_non_existent(self, mock_logging, mock_dss_client):
        handler = CMDSSHandler(uri='test_uri')

        mock_dss_client.return_value.get_domains.return_value = [
            'a domain', 'b domain', 'c domain'
        ]

        handler.delete_domain('not domain')

        mock_dss_client.return_value.get_domains.assert_called_once()
        mock_dss_client.return_value.delete_domain.assert_not_called()
Exemplo n.º 2
0
    def test_delete_domain_dss_fails(self, mock_logging, mock_dss_client):
        handler = CMDSSHandler(uri='test_uri')

        mock_dss_client.return_value.get_domains.return_value = [
            'a domain', 'b domain', 'c domain'
        ]

        mock_dss_client.return_value.delete_domain.side_effect = dss_error.Error(
            'some error')

        with self.assertRaises(CMError) as context:
            handler.delete_domain('a domain')

        mock_dss_client.return_value.delete_domain.assert_called_once_with(
            'a domain')