def test_load_provider_rules(self):
        rules_dict = {'labels': {}, 'preanchors': [], 'postanchors': []}
        with mock.patch('akanda.rug.openstack.common.jsonutils.load') as load:
            load.return_value = rules_dict
            with mock.patch('__builtin__.open') as mock_open:
                r = conf_mod.load_provider_rules('/the/path')

                mock_open.assert_called_once_with('/the/path')
                load.assert_called_once_with(mock_open.return_value)
                self.assertEqual(r, rules_dict)
示例#2
0
    def test_load_provider_rules(self):
        rules_dict = {'labels': {}, 'preanchors': [], 'postanchors': []}
        with mock.patch('oslo_serialization.jsonutils.load') as load:
            load.return_value = rules_dict
            with mock.patch('__builtin__.open') as mock_open:
                r = conf_mod.load_provider_rules('/the/path')

                mock_open.assert_called_once_with('/the/path')
                load.assert_called_once_with(mock_open.return_value)
                self.assertEqual(r, rules_dict)
示例#3
0
    def test_load_provider_rules(self):
        rules_dict = {"labels": {}, "preanchors": [], "postanchors": []}
        with mock.patch("akanda.rug.openstack.common.jsonutils.load") as load:
            load.return_value = rules_dict
            with mock.patch("__builtin__.open") as mock_open:
                r = conf_mod.load_provider_rules("/the/path")

                mock_open.assert_called_once_with("/the/path")
                load.assert_called_once_with(mock_open.return_value)
                self.assertEqual(r, rules_dict)
 def test_load_provider_rules_not_found(self, mock_open):
     mock_open.side_effect = IOError()
     res = conf_mod.load_provider_rules('/tmp/path')
     self.assertEqual(res, {})
示例#5
0
 def test_load_provider_rules_not_found(self, mock_open):
     mock_open.side_effect = IOError()
     res = conf_mod.load_provider_rules('/tmp/path')
     self.assertEqual(res, {})