コード例 #1
0
    def test_sls_path_generation(self):
        """test generation of sls paths"""
        with patch.dict(
            saltcheck.__salt__,
            {"config.get": MagicMock(return_value="saltcheck-tests")},
        ):
            testLoader = saltcheck.StateTestLoader()

            state_name = "teststate"
            expected_return = [
                "salt://teststate/saltcheck-tests",
                "salt:///saltcheck-tests",
            ]
            ret = testLoader._generate_sls_path(state_name)
            self.assertEqual(ret, expected_return)

            state_name = "teststate.long.path"
            expected_return = [
                "salt://teststate/long/path/saltcheck-tests",
                "salt://teststate/long/saltcheck-tests",
                "salt://teststate/saltcheck-tests",
            ]
            ret = testLoader._generate_sls_path(state_name)
            self.assertEqual(ret, expected_return)

            state_name = "teststate.really.long.path"
            expected_return = [
                "salt://teststate/really/long/path/saltcheck-tests",
                "salt://teststate/really/long/saltcheck-tests",
                "salt://teststate/saltcheck-tests",
            ]
            ret = testLoader._generate_sls_path(state_name)
            self.assertEqual(ret, expected_return)
コード例 #2
0
ファイル: test_saltcheck.py プロジェクト: crimv42/saltstack
    def test_sls_path_generation(self):
        '''test generation of sls paths'''
        with patch.dict(saltcheck.__salt__, {'config.get': MagicMock(return_value='saltcheck-tests')}):
            testLoader = saltcheck.StateTestLoader()

            state_name = 'teststate'
            expected_return = ['salt://teststate/saltcheck-tests',
                               'salt:///saltcheck-tests']
            ret = testLoader._generate_sls_path(state_name)
            self.assertEqual(ret, expected_return)

            state_name = 'teststate.long.path'
            expected_return = ['salt://teststate/long/path/saltcheck-tests',
                               'salt://teststate/long/saltcheck-tests',
                               'salt://teststate/saltcheck-tests']
            ret = testLoader._generate_sls_path(state_name)
            self.assertEqual(ret, expected_return)

            state_name = 'teststate.really.long.path'
            expected_return = ['salt://teststate/really/long/path/saltcheck-tests',
                               'salt://teststate/really/long/saltcheck-tests',
                               'salt://teststate/saltcheck-tests']
            ret = testLoader._generate_sls_path(state_name)
            self.assertEqual(ret, expected_return)