示例#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)
示例#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))
示例#4
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_not_exists(self):
     self.assertEquals({}, config.load_machine_config('does not exist'))
示例#6
0
 def test_load_machine_config_not_exists(self):
   self.assertEquals({}, config.load_machine_config('does not exist'))
示例#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)
示例#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))