コード例 #1
0
 def test_can_represent_linux_kernel_object_as_template(self):
     self.options['install-condition-pattern-type'] = 'linux-kernel'
     self.template[
         'install-condition-pattern-type'] = 'linux-kernel'  # nopep8
     self.template['filename'] = __file__
     obj = Object(self.options)
     self.assertEqual(obj.to_template(), self.template)
コード例 #2
0
 def test_can_generate_template(self):
     obj = Object({
         'filename': __file__,
         'mode': 'raw',
         'target-type': 'device',
         'target': '/dev/sda',
         'chunk-size': 1,
         'count': 2,
         'seek': 3,
         'skip': 4,
         'truncate': True,
     })
     expected = {
         'mode': 'raw',
         'filename': __file__,
         'install-condition': 'always',
         'target-type': 'device',
         'target': '/dev/sda',
         'chunk-size': 1,
         'count': 2,
         'seek': 3,
         'skip': 4,
         'truncate': True,
     }
     self.assertEqual(obj.to_template(), expected)
コード例 #3
0
 def test_can_represent_as_template(self):
     obj = Object(self.options)
     expected = {
         'filename': self.fn,
         'mode': 'raw',
         'chunk-size': 131072,
         'count': -1,
         'seek': 0,
         'skip': 0,
         'target-type': 'device',
         'target': '/dev/sda',
         'truncate': False,
         'install-condition': 'content-diverges',
     }
     observed = obj.to_template()
     self.assertEqual(observed, expected)
コード例 #4
0
 def test_can_represent_as_template(self):
     obj = Object(self.options)
     self.assertEqual(obj.to_template(), self.template)
コード例 #5
0
 def test_can_represent_u_boot_object_as_template(self):
     self.options['install-condition-pattern-type'] = 'u-boot'
     self.template['install-condition-pattern-type'] = 'u-boot'
     self.template['filename'] = __file__
     obj = Object(self.options)
     self.assertEqual(obj.to_template(), self.template)
コード例 #6
0
 def test_template_keeps_equal_after_object_load(self):
     obj = Object(self.default_options)
     expected = obj.to_template()
     obj.load()
     observed = obj.to_template()
     self.assertEqual(expected, observed)
コード例 #7
0
 def test_full_template(self):
     obj = Object(self.full_options)
     self.assertEqual(self.full_template, obj.to_template())
コード例 #8
0
 def test_default_template(self):
     obj = Object(self.default_options)
     self.assertEqual(self.default_template, obj.to_template())