def testGetExternalValue(self):
    self.mox.StubOutWithMock(self.settings, '_GetExternalConfiguration')

    # 1
    self.settings._settings['predefined'] = 'pre'
    # 2
    self.settings._GetExternalConfiguration('settings').AndReturn({'new2': 1})
    # 3
    self.settings._GetExternalConfiguration('settings').AndReturn({'new': 1})
    # 4
    self.settings._GetExternalConfiguration('settings').AndReturn(None)

    self.mox.ReplayAll()
    # 1
    self.assertEqual('pre', self.settings._GetExternalValue('predefined'))
    # 2
    self.assertRaises(
        AttributeError,
        self.settings._GetExternalValue,
        'not-new')
    # 3
    self.assertEqual(1, self.settings._GetExternalValue('new'))
    self.assertEqual(self.settings._settings['new'], 1)
    # 4
    self.assertRaises(
        AttributeError,
        self.settings._GetExternalValue,
        'other')
    self.mox.VerifyAll()
Test _GetExternalValue().
dataset/ETHPy150Open google/simian/src/tests/simian/settings_test.py/FilesystemSettingsTest.testGetExternalValue