'Test that conflicting contexts are resolved by precedence.'

def testRemoveContext(self):

    conf = config_lib.GrrConfigManager()
    conf.DEFINE_integer('Section1.test', 0, 'An    integer')
    conf.DEFINE_integer('Section1.test2', 9, 'An    integer')
    conf.DEFINE_context('Client    Context')
    conf.DEFINE_context('Platform:Windows')
    conf.DEFINE_context('Extra    Context')
    conf.Initialize(parser=config_lib.YamlParser, data='\n\nSection1.test:    2\n\nClient    Context:\n        Section1.test:    6\n        Section1.test2:    8\n\nPlatform:Windows:\n        Section1.test:    10\n\nExtra    Context:\n        Section1.test:    15\n')
    self.assertEqual(conf.Get('Section1.test'), 2)
    self.assertEqual(conf.Get('Section1.test2'), 9)
    conf.AddContext('Client    Context')
    self.assertEqual(conf.Get('Section1.test'), 6)
    self.assertEqual(conf.Get('Section1.test2'), 8)
    conf.RemoveContext('Client    Context')
    self.assertEqual(conf.Get('Section1.test'), 2)
    self.assertEqual(conf.Get('Section1.test2'), 9)
    conf.AddContext('Platform:Windows')
    self.assertEqual(conf.Get('Section1.test'), 10)
    self.assertEqual(conf.Get('Section1.test2'), 9)
    conf.RemoveContext('Platform:Windows')
    self.assertEqual(conf.Get('Section1.test'), 2)
    self.assertEqual(conf.Get('Section1.test2'), 9)
