81
81
sources = aptsources.SourcesList()
82
82
distro = aptsources.Distribution()
83
83
distro.get_sources(sources)
84
# test if all suits of the current distro were detected correctly
85
dist_templates = set()
88
dist_templates.add(s.template.name)
90
for d in ["edgy","edgy-security","edgy-updates","hoary","breezy", "breezy-backports"]:
91
self.assertTrue(d in dist_templates)
84
93
comp = "restricted"
85
94
distro.enable_component(sources, comp)
87
96
for entry in sources:
88
97
if (entry.type == "deb" and
89
98
entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and
90
entry.dist == "edgy"):
94
print "".join([s.str() for s in sources])
95
self.assertEqual(found, 1)
99
"edgy" in entry.dist):
100
for c in entry.comps:
102
if not found.has_key(entry.dist):
103
found[entry.dist] = 0
104
found[entry.dist] += 1
105
#print "".join([s.str() for s in sources])
107
self.assertEqual(found[key], 1)
109
# add a not-already available component
111
distro.enable_component(sources, comp)
113
for entry in sources:
114
if (entry.type == "deb" and
116
entry.template.name == "edgy"):
117
for c in entry.comps:
119
if not found.has_key(entry.dist):
120
found[entry.dist] = 0
121
found[entry.dist] += 1
122
#print "".join([s.str() for s in sources])
124
self.assertEqual(found[key], 1)
98
126
if __name__ == "__main__":