示例#1
0
    def test_template_id_exists_no_template(self):
        template_id = 'abcd1234'

        with self.provd_managers() as (_, config_manager, _):
            config_manager.find.return_value = []

            result = device_dao.template_id_exists(template_id)

            assert_that(result, equal_to(False))
            config_manager.find.assert_called_once_with({'X_type': 'device', 'id': template_id})
示例#2
0
    def test_template_id_exists_no_template(self):
        template_id = 'abcd1234'

        with self.provd_managers() as (_, config_manager, _):
            config_manager.find.return_value = []

            result = device_dao.template_id_exists(template_id)

            assert_that(result, equal_to(False))
            config_manager.find.assert_called_once_with({
                'X_type': 'device',
                'id': template_id
            })
示例#3
0
    def test_template_id_exists_with_a_template(self):
        template_id = 'abcd1234'

        with self.provd_managers() as (_, config_manager, _):
            config_manager.find.return_value = [{
                u'X_type': u'device',
                u'deletable': True,
                u'id': template_id,
                u'label': u'testtemplate',
                u'parent_ids': [],
                u'raw_config': {}}]

            result = device_dao.template_id_exists(template_id)

            assert_that(result, equal_to(True))
            config_manager.find.assert_called_once_with({'X_type': 'device', 'id': template_id})
示例#4
0
    def test_template_id_exists_with_a_template(self):
        template_id = 'abcd1234'

        with self.provd_managers() as (_, config_manager, _):
            config_manager.find.return_value = [{
                u'X_type': u'device',
                u'deletable': True,
                u'id': template_id,
                u'label': u'testtemplate',
                u'parent_ids': [],
                u'raw_config': {}
            }]

            result = device_dao.template_id_exists(template_id)

            assert_that(result, equal_to(True))
            config_manager.find.assert_called_once_with({
                'X_type': 'device',
                'id': template_id
            })