Beispiel #1
0
  def test_load_machine_config_bad(self):
    with infra_libs.temporary_directory() as temp_dir:
      filename = os.path.join(temp_dir, 'config')
      with open(filename, 'w') as fh:
        fh.write('not a json file')

      with self.assertRaises(ValueError):
        config.load_machine_config(filename)
    def test_load_machine_config_bad(self):
        with infra_libs.temporary_directory() as temp_dir:
            filename = os.path.join(temp_dir, 'config')
            with open(filename, 'w') as fh:
                fh.write('not a json file')

            with self.assertRaises(ValueError):
                config.load_machine_config(filename)
Beispiel #3
0
  def test_load_machine_config(self):
    with infra_libs.temporary_directory() as temp_dir:
      filename = os.path.join(temp_dir, 'config')
      with open(filename, 'w') as fh:
        json.dump({'foo': 'bar'}, fh)

      self.assertEquals({'foo': 'bar'}, config.load_machine_config(filename))
  def test_load_machine_config(self):
    with infra_libs.temporary_directory() as temp_dir:
      filename = os.path.join(temp_dir, 'config')
      with open(filename, 'w') as fh:
        json.dump({'foo': 'bar'}, fh)

      self.assertEquals({'foo': 'bar'}, config.load_machine_config(filename))
 def test_load_machine_config_not_exists(self):
     self.assertEquals({}, config.load_machine_config('does not exist'))
Beispiel #6
0
 def test_load_machine_config_not_exists(self):
   self.assertEquals({}, config.load_machine_config('does not exist'))
Beispiel #7
0
 def test_load_machine_config_bad(self):
   with tempfile.NamedTemporaryFile() as fh:
     fh.write('not a json file')
     fh.flush()
     with self.assertRaises(ValueError):
       config.load_machine_config(fh.name)
Beispiel #8
0
 def test_load_machine_config(self):
   with tempfile.NamedTemporaryFile() as fh:
     json.dump({'foo': 'bar'}, fh)
     fh.flush()
     self.assertEquals({'foo': 'bar'}, config.load_machine_config(fh.name))