# -*- coding: utf-8 -*-
'''
    :codeauthor: :email:`Bo Maryniuk <bo@suse.de>`
'''
from __future__ import absolute_import, print_function, unicode_literals
import datetime

from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
    NO_MOCK,
    NO_MOCK_REASON,
    MagicMock,
    patch)

from salt.ext.six.moves import zip
from salt.ext import six

import salt.utils.ssdp as ssdp
import salt.utils.stringutils

try:
    import pytest
except ImportError:
    pytest = None


@skipIf(NO_MOCK, NO_MOCK_REASON)
@skipIf(pytest is None, 'PyTest is missing')
class SSHThinTestCase(TestCase):
    '''
    TestCase for SaltSSH-related parts.
    '''
    def test_get_tops(self):
        '''
        Test thin.get_tops

        :return:
        '''

@@ -368,22 +368,20 @@
 rt six%0A%0A
-import
+from
  salt.ut
@@ -387,21 +387,20 @@
 tils
-.ssdp as ssdp
+ import thin
 %0Aimp
@@ -494,269 +494,1023 @@
 e%0A%0A%0A
-@skipIf(NO_MOCK, NO_MOCK_REASON)%0A@skipIf(pytest is None, 'PyTest is missing')%0Aclass SSHThinTestCase(TestCase):%0A    '''%0A    TestCase for SaltSSH-related parts.%0A    '''%0A    def test_get_tops(self):%0A        '''%0A        Test thin.get_tops%0A%0A        :return:%0A        '''
+class SaltSyetemExitException(Exception):%0A    '''%0A    System%0A    '''%0A    def __init__(self):%0A        Exception.__init__(self, 'The Dilithium Crystals need to be rotated.')%0A%0A%0A@skipIf(NO_MOCK, NO_MOCK_REASON)%0A@skipIf(pytest is None, 'PyTest is missing')%0Aclass SSHThinTestCase(TestCase):%0A    '''%0A    TestCase for SaltSSH-related parts.%0A    '''%0A    @patch('salt.exceptions.SaltSystemExit', MagicMock(side_effect=SaltSyetemExitException))%0A    @patch('salt.utils.thin.log', MagicMock())%0A    def test_get_ext_tops_cfg_missing_dependencies(self):%0A        '''%0A        Test thin.get_tops%0A%0A        :return:%0A        '''%0A        cfg = %5B%0A            %7B'namespace': %7B'path': '/foo', 'dependencies': %5B%5D%7D%7D,%0A        %5D%0A        with pytest.raises(Exception) as err:%0A            thin.get_ext_tops(cfg)%0A        assert 'Dilithium Crystals' in str(err)%0A        assert thin.log.error.called%0A        assert 'Missing dependencies' in thin.log.error.call_args%5B0%5D%5B0%5D%0A        assert 'jinja2, yaml, tornado, msgpack' in thin.log.error.call_args%5B0%5D%5B0%5D
 %0A

Add unit test for missing dependencies on get_ext_tops