Ejemplo n.º 1
0
    def test_parse_sysargs(self):
        dispatcher = support.Dispatcher()
        with mock_argv(
            ["plugin://script.module.codequick/test/tester", 96, ""]):
            dispatcher.parse_args()

        self.assertEqual(dispatcher.selector, "/test/tester")
    def test_parse_sysargs_with_args(self):
        dispatcher = support.Dispatcher()
        with mock_argv([
                "plugin://script.module.codequick/test/tester", 96,
                "?testdata=true&worker=false&_title_=test"
        ]):
            dispatcher.parse_args()

        self.assertEqual(dispatcher.selector, "/test/tester")
        self.assertTrue(dispatcher.params.get("testdata") == "true")
        self.assertTrue(dispatcher.params.get("worker") == "false")
        self.assertTrue(dispatcher.params.get("_title_") == "test")
        self.assertTrue(dispatcher.callback_params.get("testdata") == "true")
        self.assertTrue(dispatcher.callback_params.get("worker") == "false")
    def test_parse_params_pickle_py3(self):
        dispatcher = support.Dispatcher()
        with mock_argv([
                "plugin://script.module.codequick/test/tester", 96,
                "?_pickle_=8004952c000000000000007d94288c08746573746461746194888c06776f726b657294898c075f74697"
                "46c655f948c047465737494752e"
        ]):
            dispatcher.parse_args()

        self.assertEqual(dispatcher.selector, "/test/tester")
        self.assertTrue(dispatcher.params.get("testdata") is True)
        self.assertTrue(dispatcher.params.get("worker") is False)
        self.assertTrue(dispatcher.params.get("_title_") == "test")
        self.assertTrue(dispatcher.callback_params.get("testdata") is True)
        self.assertTrue(dispatcher.callback_params.get("worker") is False)
    def test_parse_params_pickle_py2(self):
        dispatcher = support.Dispatcher()
        with mock_argv([
                "plugin://script.module.codequick/test/tester", 96,
                "?_pickle_=80027d7100285506776f726b65727101895508746573746461746171028855075f7469746c655f710355"
                "04746573747104752e"
        ]):
            dispatcher.parse_args()

        self.assertEqual(dispatcher.selector, "/test/tester")
        self.assertTrue(dispatcher.params.get("testdata") is True)
        self.assertTrue(dispatcher.params.get("worker") is False)
        self.assertTrue(dispatcher.params.get("_title_") == "test")
        self.assertTrue(dispatcher.callback_params.get("testdata") is True)
        self.assertTrue(dispatcher.callback_params.get("worker") is False)
Ejemplo n.º 5
0
    def test_parse_params_pickle_py3(self):
        dispatcher = support.Dispatcher()
        with mock_argv([
                "plugin://script.module.codequick/test/tester", 96,
                "?_pickle_=8004952c000000000000007d94288c08746573746461746194888c06776f726b657294898c075f74697"
                "46c655f948c047465737494752e"
        ]):
            dispatcher.parse_args()

        self.assertDictContainsSubset(
            {
                "testdata": True,
                "worker": False,
                "_title_": "test"
            }, dispatcher.params)
        self.assertDictContainsSubset({
            "testdata": True,
            "worker": False
        }, dispatcher.callback_params)
Ejemplo n.º 6
0
    def test_parse_params_pickle_py2(self):
        dispatcher = support.Dispatcher()
        with mock_argv([
                "plugin://script.module.codequick/test/tester", 96,
                "?_pickle_=80027d7100285506776f726b65727101895508746573746461746171028855075f7469746c655f710355"
                "04746573747104752e"
        ]):
            dispatcher.parse_args()

        self.assertDictContainsSubset(
            {
                "testdata": True,
                "worker": False,
                "_title_": "test"
            }, dispatcher.params)
        self.assertDictContainsSubset({
            "testdata": True,
            "worker": False
        }, dispatcher.callback_params)
Ejemplo n.º 7
0
    def test_parse_sysargs_with_args(self):
        dispatcher = support.Dispatcher()
        with mock_argv([
                "plugin://script.module.codequick/test/tester", 96,
                "?testdata=true&worker=false&_title_=test"
        ]):
            dispatcher.parse_args()

        self.assertEqual(dispatcher.selector, "/test/tester")
        self.assertDictContainsSubset(
            {
                "testdata": "true",
                "worker": "false",
                "_title_": "test"
            }, dispatcher.params)
        self.assertDictContainsSubset({
            "testdata": "true",
            "worker": "false"
        }, dispatcher.callback_params)
Ejemplo n.º 8
0
 def setUp(self):
     self.dispatcher = support.Dispatcher()