

def testParseNfsExportFile(self):
    test_data = '\n    /path/to/foo -rw,sync host1(ro) host2\n    /path/to/bar *.example.org(all_squash,ro) \\\n        192.168.1.0/24 (rw) # Mistake here - space makes this default.\n    '
    exports = StringIO.StringIO(test_data)
    parser = config_file.NfsExportsParser()
    results = list(parser.Parse(None, exports, None))
    self.assertEqual('/path/to/foo', results[0].share)
    self.assertItemsEqual(['rw', 'sync'], results[0].defaults)
    self.assertEqual('host1', results[0].clients[0].host)
    self.assertItemsEqual(['ro'], results[0].clients[0].options)
    self.assertEqual('host2', results[0].clients[1].host)
    self.assertItemsEqual([], results[0].clients[1].options)
    self.assertEqual('/path/to/bar', results[1].share)
    self.assertItemsEqual(['rw'], results[1].defaults)
    self.assertEqual('*.example.org', results[1].clients[0].host)
    self.assertItemsEqual(['all_squash', 'ro'], results[1].clients[0].options)
    self.assertEqual('192.168.1.0/24', results[1].clients[1].host)
    self.assertItemsEqual([], results[1].clients[1].options)

dataset/ETHPy150Open google/grr/grr/parsers/config_file_test.py NfsExportParserTests.testParseNfsExportFile/original