Ejemplo n.º 1
0
 def test_boot_resource_to_dict_with_sets(self):
     resource = factory.make_BootResource()
     resource_set = factory.make_BootResourceSet(resource)
     dict_representation = boot_resource_to_dict(resource, with_sets=True)
     self.assertEqual(
         boot_resource_set_to_dict(resource_set),
         dict_representation["sets"][resource_set.version],
     )
Ejemplo n.º 2
0
 def test_boot_resource_to_dict_without_sets(self):
     resource = factory.make_BootResource()
     factory.make_BootResourceSet(resource)
     dict_representation = boot_resource_to_dict(resource, with_sets=False)
     self.assertEqual(resource.id, dict_representation['id'])
     self.assertEqual(BOOT_RESOURCE_TYPE_CHOICES_DICT[resource.rtype],
                      dict_representation['type'])
     self.assertEqual(resource.name, dict_representation['name'])
     self.assertEqual(resource.architecture,
                      dict_representation['architecture'])
     self.assertEqual(get_boot_resource_uri(resource),
                      dict_representation['resource_uri'])
     self.assertFalse('sets' in dict_representation)
Ejemplo n.º 3
0
 def test_boot_resource_to_dict_without_sets(self):
     resource = factory.make_BootResource()
     factory.make_BootResourceSet(resource)
     dict_representation = boot_resource_to_dict(resource, with_sets=False)
     self.assertEqual(resource.id, dict_representation["id"])
     self.assertEqual(
         BOOT_RESOURCE_TYPE_CHOICES_DICT[resource.rtype],
         dict_representation["type"],
     )
     self.assertEqual(resource.name, dict_representation["name"])
     self.assertEqual(resource.architecture,
                      dict_representation["architecture"])
     self.assertEqual(
         get_boot_resource_uri(resource),
         dict_representation["resource_uri"],
     )
     self.assertFalse("sets" in dict_representation)