Пример #1
0
 def test_initial_load_win(self):
   with luci_context.write(something={'data': True}):
     self.assertDictEqual(luci_context.read_full(),
                          {'something': {'data': True}})
     self.assertDictEqual(luci_context._CUR_CONTEXT,
                          {'something': {'data': True}})
     self.assertDictEqual(luci_context.read('something'), {'data': True})
Пример #2
0
  def test_initial_load_dne(self):
    self.assertDictEqual(luci_context.read_full(), {})
    self.assertDictEqual(luci_context._CUR_CONTEXT, {})

    def nope():
      raise Exception('I SHOULD NOT BE CALLED')
    og_load = luci_context._initial_load
    luci_context._initial_load = nope
    try:
      self.assertIsNone(luci_context.read('section'))
    finally:
      luci_context._initial_load = og_load