def test_pack_sources(self):
        '''
            Test to accepts list of dicts (or a string representing a
            list of dicts) and packs the key/value pairs into a single dict.
        '''
        with patch.object(salt.utils.yaml, 'safe_load',
                          MagicMock(side_effect=yaml.parser.ParserError('f'))):
            with patch.dict(pkg_resource.__salt__,
                            {'pkg.normalize_name': MagicMock()}):
                self.assertDictEqual(pkg_resource.pack_sources('sources'), {})

                self.assertDictEqual(pkg_resource.pack_sources(['A', 'a']), {})

                self.assertTrue(pkg_resource.pack_sources([{'A': 'a'}]))
Exemple #2
0
    def test_pack_sources(self):
        '''
            Test to accepts list of dicts (or a string representing a
            list of dicts) and packs the key/value pairs into a single dict.
        '''
        with patch.object(yaml,
                          'safe_load',
                          MagicMock(side_effect=yaml.parser.ParserError('f'))):
            with patch.dict(pkg_resource.__salt__,
                            {'pkg.normalize_name': MagicMock()}):
                self.assertDictEqual(pkg_resource.pack_sources('sources'), {})

                self.assertDictEqual(pkg_resource.pack_sources(['A', 'a']), {})

                self.assertTrue(pkg_resource.pack_sources([{'A': 'a'}]))
Exemple #3
0
    def test_pack_sources(self):
        """
        Test to accepts list of dicts (or a string representing a
        list of dicts) and packs the key/value pairs into a single dict.
        """
        with patch.object(
            salt.utils.yaml,
            "safe_load",
            MagicMock(side_effect=yaml.parser.ParserError("f")),
        ):
            with patch.dict(pkg_resource.__salt__, {"pkg.normalize_name": MagicMock()}):
                self.assertDictEqual(pkg_resource.pack_sources("sources"), {})

                self.assertDictEqual(pkg_resource.pack_sources(["A", "a"]), {})

                self.assertTrue(pkg_resource.pack_sources([{"A": "a"}]))