@@ -0,0 +1,3077 @@
+# -*- coding: utf-8 -*-%0A%0A# Import Python libs%0Afrom __future__ import absolute_import%0A%0A# Import Salt Testing Libs%0Afrom tests.support.mixins import LoaderModuleMockMixin%0Afrom tests.support.unit import skipIf, TestCase%0Afrom tests.support.mock import (%0A    NO_MOCK,%0A    NO_MOCK_REASON,%0A    MagicMock,%0A    patch)%0A%0A# Import Salt Libs%0Aimport salt.modules.pkgng as pkgng%0A%0A%0A@skipIf(NO_MOCK, NO_MOCK_REASON)%0Aclass PkgNgTestCase(TestCase, LoaderModuleMockMixin):%0A    '''%0A    Test cases for salt.modules.pkgng%0A    '''%0A%0A    @classmethod%0A    def setup_loader_modules(cls):%0A        return %7B%0A            pkgng: %7B%0A                '__salt__': %7B%7D%0A            %7D%0A        %7D%0A%0A    def test_lock(self):%0A        '''%0A        Test pkgng.lock%0A        '''%0A        lock_cmd = MagicMock(return_value=%7B%0A            'stdout': 'pkga-1.0%5Cnpkgb-2.0%5Cn',%0A            'retcode': 0%0A        %7D)%0A        with patch.dict(pkgng.__salt__, %7B'cmd.run_all': lock_cmd%7D):%0A%0A            result = pkgng.lock('pkga')%0A            self.assertTrue(result)%0A            lock_cmd.assert_called_with(%0A                %5B'pkg', 'lock', '-y', '--quiet', '--show-locked', 'pkga'%5D,%0A                output_loglevel='trace', python_shell=False%0A            )%0A%0A            result = pkgng.lock('dummy')%0A            self.assertFalse(result)%0A            lock_cmd.assert_called_with(%0A                %5B'pkg', 'lock', '-y', '--quiet', '--show-locked', 'dummy'%5D,%0A                output_loglevel='trace', python_shell=False%0A            )%0A%0A    def test_unlock(self):%0A        '''%0A        Test pkgng.unlock%0A        '''%0A        unlock_cmd = MagicMock(return_value=%7B%0A            'stdout': 'pkga-1.0%5Cnpkgb-2.0%5Cn',%0A            'retcode': 0%0A        %7D)%0A        with patch.dict(pkgng.__salt__, %7B'cmd.run_all': unlock_cmd%7D):%0A%0A            result = pkgng.unlock('pkga')%0A            self.assertFalse(result)%0A            unlock_cmd.assert_called_with(%0A                %5B'pkg', 'unlock', '-y', '--quiet', '--show-locked', 'pkga'%5D,%0A                output_loglevel='trace', python_shell=False%0A            )%0A%0A            result = pkgng.unlock('dummy')%0A            self.assertTrue(result)%0A            unlock_cmd.assert_called_with(%0A                %5B'pkg', 'unlock', '-y', '--quiet', '--show-locked', 'dummy'%5D,%0A                output_loglevel='trace', python_shell=False%0A            )%0A%0A    def test_locked(self):%0A        '''%0A        Test pkgng.unlock%0A        '''%0A        lock_cmd = MagicMock(return_value=%7B%0A            'stdout': 'pkga-1.0%5Cnpkgb-2.0%5Cn',%0A            'retcode': 0%0A        %7D)%0A        with patch.dict(pkgng.__salt__, %7B'cmd.run_all': lock_cmd%7D):%0A%0A            result = pkgng.locked('pkga')%0A            self.assertTrue(result)%0A            lock_cmd.assert_called_with(%0A                %5B'pkg', 'lock', '-y', '--quiet', '--show-locked'%5D,%0A                output_loglevel='trace', python_shell=False%0A            )%0A%0A            result = pkgng.locked('dummy')%0A            self.assertFalse(result)%0A            lock_cmd.assert_called_with(%0A                %5B'pkg', 'lock', '-y', '--quiet', '--show-locked'%5D,%0A                output_loglevel='trace', python_shell=False%0A            )

Add unit tests for pkgng.lock and pkgng.unlock