Ejemplo n.º 1
0
 def testUpdateVariable(self):
     """Test updating a variable that already exists."""
     key, val = self.contents_str[2].split('=')
     new_val = 'test_update'
     self._verify_key_pair(key, val)
     prebuilt.UpdateLocalFile(self.version_file, new_val)
     self._verify_key_pair(key, new_val)
Ejemplo n.º 2
0
 def testAddVariableThatDoesNotExist(self):
     """Add in a new variable that was no present in the file."""
     key = 'PORTAGE_BINHOST'
     value = '1234567'
     prebuilt.UpdateLocalFile(self.version_file, value)
     print(self.version_file)
     self._read_version_file()
     self._verify_key_pair(key, value)
     print(self.version_file)
Ejemplo n.º 3
0
 def testUpdateNonExistentFile(self):
     key = 'PORTAGE_BINHOST'
     value = '1234567'
     non_existent_file = tempfile.mktemp()
     try:
         prebuilt.UpdateLocalFile(non_existent_file, value)
         file_contents = self._read_version_file(non_existent_file)
         self.assertEqual(file_contents, ['%s="%s"' % (key, value)])
     finally:
         if os.path.exists(non_existent_file):
             os.remove(non_existent_file)