@@ -0,0 +1,1784 @@
+# -*- coding: utf-8 -*-%0A'''%0A    :codeauthor: :email:%60Pedro Algarvio (pedro@algarvio.me)%60%0A    :copyright: %C2%A9 2013 by the SaltStack Team, see AUTHORS for more details.%0A    :license: Apache 2.0, see LICENSE for more details.%0A%0A%0A    tests.unit.utils.format_call_test%0A    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0A    Test %60salt.utils.format_call%60%0A'''%0A%0A# Import Salt Testing libs%0Afrom salttesting import TestCase%0Afrom salttesting.helpers import ensure_in_syspath%0Aensure_in_syspath('../../')%0A%0A# Import salt libs%0Afrom salt.utils import format_call%0Afrom salt.exceptions import SaltInvocationError%0A%0A%0Aclass TestFormatCall(TestCase):%0A    def test_simple_args_passing(self):%0A        def foo(one, two=2, three=3):%0A            pass%0A%0A        self.assertEqual(%0A            format_call(foo, dict(one=10, two=20, three=30)),%0A            %7B'args': %5B10%5D, 'kwargs': dict(two=20, three=30)%7D%0A        )%0A        self.assertEqual(%0A            format_call(foo, dict(one=10, two=20)),%0A            %7B'args': %5B10%5D, 'kwargs': dict(two=20, three=3)%7D%0A        )%0A        self.assertEqual(%0A            format_call(foo, dict(one=2)),%0A            %7B'args': %5B2%5D, 'kwargs': dict(two=2, three=3)%7D%0A        )%0A%0A    def test_mimic_typeerror_exceptions(self):%0A        def foo(one, two=2, three=3):%0A            pass%0A        def foo2(one, two, three=3):%0A            pass%0A%0A        with self.assertRaisesRegexp(%0A                SaltInvocationError,%0A                r'foo takes at least 1 argument %5C(0 given%5C)'):%0A            format_call(foo, dict(two=3))%0A%0A        with self.assertRaisesRegexp(%0A                TypeError,%0A                r'foo2 takes at least 2 arguments %5C(1 given%5C)'):%0A            format_call(foo2, dict(one=1))%0A%0A%0A%0Aif __name__ == '__main__':%0A    from integration import run_tests%0A    run_tests(TestFormatCall, needs_daemon=False)%0A

Add unit tests to `salt.utils.format_call()`.