示例#1
0
  def test_resolve_ids(self):
    """Test various ID resolution scenarios."""
    self.cr_load("firstrun") # anything
    s = Shadow(self.loc_in_cr(shadow))

    found = [{'imageID':0, 'md5':'a', 'path':'m'}]
    self.assertEquals((found[0], 'move'), s.resolve_partial_id('a', "_", found))
示例#2
0
 def test_bail_on_bad_merge(self):
   """Must bail when md5/path pair matches differently on the two aspects."""
   self.cr_load("bad_merge")
   s = Shadow(self.loc_in_cr(shadow))
   r = Reader(self.loc_in_cr("KPA"))
   self.expect_error(lambda:s.apply_latest_data(r.read_latest_data(), 'fake'),
                     "Impossible to resolve",
                     "Bail on bad merge.")
示例#3
0
 def test_init_db(self):
   """Must create a DB3 if none exists."""
   self.cr_load("firstrun")
   self.cr_nexist(shadow)
   
   s = Shadow(self.loc_in_cr(shadow))
   self.assertEqual(s.get_checksum(), None)
   self.cr_exist(shadow)
示例#4
0
 def test_bail_on_high_version(self):
   """Must bail on version number that is too high."""
   self.cr_load("standard")
   self.cr_load("overlay-db-future", append=True)
   
   s = Shadow(self.loc_in_cr(shadow))
   self.expect_error(lambda:s.get_checksum(),
                     "DB version too high",
                     "Bail on too-high version.")