'Test that we can update the config.'

def testUpdateConfiguration(self):

    self.config_file = os.path.join(self.temp_dir, 'ConfigActionTest.yaml')
    config.CONFIG.SetWriteBack(self.config_file)
    self.assertRaises(IOError, open, self.config_file)
    location = ['http://www.example1.com/', 'http://www.example2.com/']
    request = rdf_protodict.Dict()
    request['Client.server_urls'] = location
    request['Client.foreman_check_frequency'] = 3600
    result = self.RunAction(admin.UpdateConfiguration, request)
    self.assertEqual(result, [])
    self.assertEqual(config.CONFIG['Client.foreman_check_frequency'], 3600)
    data = open(self.config_file, 'rb').read()
    self.assertTrue(('server_urls:    {0}'.format(','.join(location)) in data))
    self.urls = []
    def FakeUrlOpen(url=None, data=None, **_):
        self.urls.append(url)
        response = requests.Response()
        response.status_code = 200
        response._content = data
        return response
    with utils.Stubber(requests, 'request', FakeUrlOpen):
        client_context = comms.GRRHTTPClient(worker=MockClientWorker())
        client_context.MakeRequest('')
    self.assertTrue((location[0] in self.urls[0]))
