'Test source list formated as per rfc822 style.'

def testRFC822StyleSourceDataParser(self):

    test_data = "\n                #    comment    comment    comment\n                Types:    deb    deb-src\n                URIs:                http://example.com/debian\n                        http://1.example.com/debian1\n                        http://2.example.com/debian2\n\n                        http://willdetect.example.com/debian-strange\n                URIs    :        ftp://3.example.com/debian3\n                        http://4.example.com/debian4\n                        blahblahblahblahblahlbha\n                        http://willdetect2.example.com/debian-w2\n\n                        http://willdetect3.example.com/debian-w3\n                URI\n                URI    :        ssh://5.example.com/debian5\n                Suites:    stable    testing\n                Sections:    component1    component2\n                Description:    short\n                    long    long    long\n                [option1]:    [option1-value]\n\n                deb-src    [arch=amd64,trusted=yes]    ftp://security.debian.org/    wheezy/updates    main    contrib    non-free\n\n                #    comment    comment    comment\n                Types:    deb\n                URI:ftp://another.example.com/debian2\n                Suites:    experimental\n                Sections:    component1    component2\n                Enabled:    no\n                Description:    http://debian.org\n                    This    URL    shouldn't    be    picked    up    by    the    parser\n                [option1]:    [option1-value]\n\n                "
    file_obj = StringIO.StringIO(test_data)
    pathspec = rdf_paths.PathSpec(path='/etc/apt/sources.list.d/rfc822.list')
    stat = rdf_client.StatEntry(pathspec=pathspec)
    parser = config_file.APTPackageSourceParser()
    results = list(parser.Parse(stat, file_obj, None))
    result = [d for d in results if isinstance(d, rdf_protodict.AttributedDict)][0]
    self.assertEqual('/etc/apt/sources.list.d/rfc822.list', result.filename)
    self.assertEqual(11, len(result.uris))
    self.assertEqual('ftp', result.uris[0].transport)
    self.assertEqual('security.debian.org', result.uris[0].host)
    self.assertEqual('/', result.uris[0].path)
    self.assertEqual('http', result.uris[1].transport)
    self.assertEqual('example.com', result.uris[1].host)
    self.assertEqual('/debian', result.uris[1].path)
    self.assertEqual('http', result.uris[2].transport)
    self.assertEqual('1.example.com', result.uris[2].host)
    self.assertEqual('/debian1', result.uris[2].path)
    self.assertEqual('http', result.uris[3].transport)
    self.assertEqual('2.example.com', result.uris[3].host)
    self.assertEqual('/debian2', result.uris[3].path)
    self.assertEqual('http', result.uris[4].transport)
    self.assertEqual('willdetect.example.com', result.uris[4].host)
    self.assertEqual('/debian-strange', result.uris[4].path)
    self.assertEqual('ftp', result.uris[5].transport)
    self.assertEqual('3.example.com', result.uris[5].host)
    self.assertEqual('/debian3', result.uris[5].path)
    self.assertEqual('http', result.uris[6].transport)
    self.assertEqual('4.example.com', result.uris[6].host)
    self.assertEqual('/debian4', result.uris[6].path)
    self.assertEqual('http', result.uris[7].transport)
    self.assertEqual('willdetect2.example.com', result.uris[7].host)
    self.assertEqual('/debian-w2', result.uris[7].path)
    self.assertEqual('http', result.uris[8].transport)
    self.assertEqual('willdetect3.example.com', result.uris[8].host)
    self.assertEqual('/debian-w3', result.uris[8].path)
    self.assertEqual('ssh', result.uris[9].transport)
    self.assertEqual('5.example.com', result.uris[9].host)
    self.assertEqual('/debian5', result.uris[9].path)
    self.assertEqual('ftp', result.uris[10].transport)
    self.assertEqual('another.example.com', result.uris[10].host)
    self.assertEqual('/debian2', result.uris[10].path)
