コード例 #1
0
    def test_empty_force_no_source(self):
        slot_dict = OrderedDict({"interface": "content"})
        slot_name = "slot-test"

        slot = ContentSlot(use_source_key=False, slot_name=slot_name)

        self.assertEqual(slot_dict, slot.to_yaml_object())
        self.assertEqual(slot_name, slot.slot_name)
        self.assertRaises(errors.SlotValidationError, slot.validate)
        self.assertEqual(set(), slot.get_content_dirs(installed_path=""))
コード例 #2
0
    def test_empty(self):
        slot_dict = OrderedDict({"interface": "content"})
        slot_name = "slot-test"

        slot = ContentSlot(slot_name=slot_name)

        # "use_source_key" is default, account for that.
        transformed_dict = slot_dict.copy()
        transformed_dict["source"] = {}

        self.assertEqual(transformed_dict, slot.to_yaml_object())
        self.assertEqual(slot_name, slot.slot_name)
        self.assertRaises(errors.SlotValidationError, slot.validate)
        self.assertEqual(set(), slot.get_content_dirs(installed_path=""))