3 from db_test import DBDakTestCase
5 from daklib.dbconn import Architecture, Suite, get_suite_architectures, \
6 get_architecture_suites, Maintainer, DBSource, Location, PoolFile, \
7 check_poolfile, get_poolfile_like_name, get_source_in_suite, \
8 get_suites_source_in, add_dsc_to_db, source_exists, DBBinary, \
9 get_suites_binary_in, add_deb_to_db, Component, \
10 get_component_by_package_suite
11 from daklib.queue_install import package_to_suite
12 from daklib.queue import get_newest_source, get_suite_version_by_source, \
13 get_source_by_package_and_suite, get_suite_version_by_package
15 from sqlalchemy.orm.exc import MultipleResultsFound
19 'fake package class used for testing'
27 'fake Upload class used for testing'
29 def __init__(self, pkg):
32 class PackageTestCase(DBDakTestCase):
34 PackageTestCase checks the handling of source and binary packages in dak's
38 def setup_suites(self):
39 "setup a hash of Suite objects in self.suite"
41 if 'suite' in self.__dict__:
44 for suite_name in ('lenny', 'squeeze', 'sid'):
45 self.suite[suite_name] = Suite(suite_name = suite_name, version = '-')
46 self.session.add_all(self.suite.values())
48 def setup_architectures(self):
49 "setup Architecture objects in self.arch and connect to suites"
51 if 'arch' in self.__dict__:
55 for arch_string in ('source', 'all', 'i386', 'amd64', 'kfreebsd-i386'):
56 self.arch[arch_string] = Architecture(arch_string)
57 if arch_string != 'kfreebsd-i386':
58 self.arch[arch_string].suites = self.suite.values()
60 self.arch[arch_string].suites = [self.suite['squeeze'], self.suite['sid']]
61 # hard code ids for source and all
62 self.arch['source'].arch_id = 1
63 self.arch['all'].arch_id = 2
64 self.session.add_all(self.arch.values())
66 def setup_components(self):
67 'create some Component objects'
69 if 'comp' in self.__dict__:
72 self.comp['main'] = Component(component_name = 'main')
73 self.comp['contrib'] = Component(component_name = 'contrib')
74 self.session.add_all(self.comp.values())
76 def setup_locations(self):
77 'create some Location objects'
79 if 'loc' in self.__dict__:
81 self.setup_components()
83 self.loc['main'] = Location( \
84 path = '/srv/ftp-master.debian.org/ftp/pool/', \
85 component = self.comp['main'])
86 self.loc['contrib'] = Location( \
87 path = '/srv/ftp-master.debian.org/ftp/pool/', \
88 component = self.comp['contrib'])
89 self.session.add_all(self.loc.values())
91 def setup_poolfiles(self):
92 'create some PoolFile objects'
94 if 'file' in self.__dict__:
96 self.setup_locations()
98 self.file['hello_2.2-3.dsc'] = PoolFile(filename = 'main/h/hello/hello_2.2-3.dsc', \
99 location = self.loc['main'], filesize = 0, md5sum = '')
100 self.file['hello_2.2-2.dsc'] = PoolFile(filename = 'main/h/hello/hello_2.2-2.dsc', \
101 location = self.loc['main'], filesize = 0, md5sum = '')
102 self.file['hello_2.2-1.dsc'] = PoolFile(filename = 'main/h/hello/hello_2.2-1.dsc', \
103 location = self.loc['main'], filesize = 0, md5sum = '')
104 self.file['gnome-hello_3.0-1.dsc'] = PoolFile( \
105 filename = 'main/g/gnome-hello/gnome-hello_3.0-1.dsc', \
106 location = self.loc['contrib'], filesize = 0, md5sum = '')
107 self.file['hello_2.2-1_i386.deb'] = PoolFile( \
108 filename = 'main/h/hello/hello_2.2-1_i386.deb', \
109 location = self.loc['main'], filesize = 0, md5sum = '')
110 self.file['gnome-hello_2.2-1_i386.deb'] = PoolFile( \
111 filename = 'main/h/hello/gnome-hello_2.2-1_i386.deb', \
112 location = self.loc['main'], filesize = 0, md5sum = '')
113 self.file['python-hello_2.2-1_all.deb'] = PoolFile( \
114 filename = 'main/h/hello/python-hello_2.2-1_all.deb', \
115 location = self.loc['main'], filesize = 0, md5sum = '')
116 self.file['gnome-hello_3.0-1_i386.deb'] = PoolFile( \
117 filename = 'main/g/gnome-hello/gnome-hello_3.0-1_i386.deb', \
118 location = self.loc['contrib'], filesize = 0, md5sum = '')
119 self.file['sl_3.03-16.dsc'] = PoolFile(filename = 'main/s/sl/sl_3.03-16.dsc', \
120 location = self.loc['main'], filesize = 0, md5sum = '')
121 self.file['python2.6_2.6.6-8.dsc'] = PoolFile( \
122 filename = 'main/p/python2.6/python2.6_2.6.6-8.dsc', \
123 location = self.loc['main'], filesize = 0, md5sum = '')
124 self.session.add_all(self.file.values())
126 def setup_maintainers(self):
127 'create some Maintainer objects'
129 if 'maintainer' in self.__dict__:
132 self.maintainer['maintainer'] = Maintainer(name = 'Mr. Maintainer')
133 self.maintainer['uploader'] = Maintainer(name = 'Mrs. Uploader')
134 self.maintainer['lazyguy'] = Maintainer(name = 'Lazy Guy')
135 self.session.add_all(self.maintainer.values())
137 def setup_sources(self):
138 'create DBSource objects'
140 if 'source' in self.__dict__:
142 self.setup_maintainers()
144 self.setup_poolfiles()
146 self.source['hello_2.2-2'] = DBSource(source = 'hello', version = '2.2-2', \
147 maintainer = self.maintainer['maintainer'], \
148 changedby = self.maintainer['uploader'], \
149 poolfile = self.file['hello_2.2-2.dsc'], install_date = self.now())
150 self.source['hello_2.2-2'].suites.append(self.suite['sid'])
151 self.source['hello_2.2-1'] = DBSource(source = 'hello', version = '2.2-1', \
152 maintainer = self.maintainer['maintainer'], \
153 changedby = self.maintainer['uploader'], \
154 poolfile = self.file['hello_2.2-1.dsc'], install_date = self.now())
155 self.source['hello_2.2-1'].suites.append(self.suite['sid'])
156 self.source['gnome-hello_3.0-1'] = DBSource(source = 'gnome-hello', \
157 version = '3.0-1', maintainer = self.maintainer['maintainer'], \
158 changedby = self.maintainer['uploader'], \
159 poolfile = self.file['gnome-hello_3.0-1.dsc'], install_date = self.now())
160 self.source['gnome-hello_3.0-1'].suites.append(self.suite['sid'])
161 self.source['sl_3.03-16'] = DBSource(source = 'sl', version = '3.03-16', \
162 maintainer = self.maintainer['maintainer'], \
163 changedby = self.maintainer['uploader'], \
164 poolfile = self.file['sl_3.03-16.dsc'], install_date = self.now())
165 self.source['sl_3.03-16'].suites.append(self.suite['squeeze'])
166 self.source['sl_3.03-16'].suites.append(self.suite['sid'])
167 self.session.add_all(self.source.values())
169 def setup_binaries(self):
170 'create DBBinary objects'
172 if 'binary' in self.__dict__:
175 self.setup_architectures()
177 self.binary['hello_2.2-1_i386'] = DBBinary(package = 'hello', \
178 source = self.source['hello_2.2-1'], version = '2.2-1', \
179 maintainer = self.maintainer['maintainer'], \
180 architecture = self.arch['i386'], \
181 poolfile = self.file['hello_2.2-1_i386.deb'])
182 self.binary['hello_2.2-1_i386'].suites.append(self.suite['squeeze'])
183 self.binary['hello_2.2-1_i386'].suites.append(self.suite['sid'])
184 self.binary['gnome-hello_2.2-1_i386'] = DBBinary(package = 'gnome-hello', \
185 source = self.source['hello_2.2-1'], version = '2.2-1', \
186 maintainer = self.maintainer['maintainer'], \
187 architecture = self.arch['i386'], \
188 poolfile = self.file['gnome-hello_2.2-1_i386.deb'])
189 self.binary['gnome-hello_2.2-1_i386'].suites.append(self.suite['squeeze'])
190 self.binary['gnome-hello_2.2-1_i386'].suites.append(self.suite['sid'])
191 self.binary['gnome-hello_3.0-1_i386'] = DBBinary(package = 'gnome-hello', \
192 source = self.source['gnome-hello_3.0-1'], version = '3.0-1', \
193 maintainer = self.maintainer['maintainer'], \
194 architecture = self.arch['i386'], \
195 poolfile = self.file['gnome-hello_3.0-1_i386.deb'])
196 self.binary['gnome-hello_3.0-1_i386'].suites.append(self.suite['sid'])
197 self.binary['python-hello_2.2-1_i386'] = DBBinary(package = 'python-hello', \
198 source = self.source['hello_2.2-1'], version = '2.2-1', \
199 maintainer = self.maintainer['maintainer'], \
200 architecture = self.arch['all'], \
201 poolfile = self.file['python-hello_2.2-1_all.deb'])
202 self.binary['python-hello_2.2-1_i386'].suites.append(self.suite['squeeze'])
203 self.session.add_all(self.binary.values())
206 super(PackageTestCase, self).setUp()
207 self.setup_binaries()
208 # flush to make sure that the setup is correct
211 def test_suite_architecture(self):
212 # check the id for architectures source and all
213 self.assertEqual(1, self.arch['source'].arch_id)
214 self.assertEqual(2, self.arch['all'].arch_id)
215 # check the many to many relation between Suite and Architecture
216 self.assertEqual('source', self.suite['lenny'].architectures[0])
217 self.assertEqual(4, len(self.suite['lenny'].architectures))
218 self.assertEqual(3, len(self.arch['i386'].suites))
219 # check the function get_suite_architectures()
220 architectures = get_suite_architectures('lenny', session = self.session)
221 self.assertEqual(4, len(architectures))
222 self.assertTrue(self.arch['source'] in architectures)
223 self.assertTrue(self.arch['all'] in architectures)
224 self.assertTrue(self.arch['kfreebsd-i386'] not in architectures)
225 architectures = get_suite_architectures('sid', session = self.session)
226 self.assertEqual(5, len(architectures))
227 self.assertTrue(self.arch['kfreebsd-i386'] in architectures)
228 architectures = get_suite_architectures('lenny', skipsrc = True, session = self.session)
229 self.assertEqual(3, len(architectures))
230 self.assertTrue(self.arch['source'] not in architectures)
231 architectures = get_suite_architectures('lenny', skipall = True, session = self.session)
232 self.assertEqual(3, len(architectures))
233 self.assertTrue(self.arch['all'] not in architectures)
234 # check the function get_architecture_suites()
235 suites = get_architecture_suites('i386', self.session)
236 self.assertEqual(3, len(suites))
237 self.assertTrue(self.suite['lenny'] in suites)
238 suites = get_architecture_suites('kfreebsd-i386', self.session)
239 self.assertEqual(2, len(suites))
240 self.assertTrue(self.suite['lenny'] not in suites)
242 def test_poolfiles(self):
244 Test the relation of the classes PoolFile and Location.
246 The code needs some explaination. The property Location.files is not a
247 list as in other relations because such a list would become rather
248 huge. It is a query object that can be queried, filtered, and iterated
249 as usual. But list like methods like append() and remove() are
250 supported as well which allows code like:
252 somelocation.files.append(somefile)
255 main = self.loc['main']
256 contrib = self.loc['contrib']
257 self.assertEqual('/srv/ftp-master.debian.org/ftp/pool/', main.path)
258 count = len(self.file.keys()) - 2
259 self.assertEqual(count, main.files.count())
260 self.assertEqual(2, contrib.files.count())
261 poolfile = main.files. \
262 filter(PoolFile.filename.like('%/hello/hello%')). \
263 order_by(PoolFile.filename)[0]
264 self.assertEqual('main/h/hello/hello_2.2-1.dsc', poolfile.filename)
265 self.assertEqual(main, poolfile.location)
267 self.assertEqual(poolfile, \
268 self.session.query(PoolFile).get(poolfile.file_id))
269 self.assertEqual(None, self.session.query(PoolFile).get(-1))
270 # test remove() and append()
271 main.files.remove(self.file['sl_3.03-16.dsc'])
272 contrib.files.append(self.file['sl_3.03-16.dsc'])
273 self.assertEqual(count - 1, main.files.count())
274 self.assertEqual(3, contrib.files.count())
276 self.assertEqual('/srv/ftp-master.debian.org/ftp/pool/main/s/sl/sl_3.03-16.dsc', \
277 self.file['sl_3.03-16.dsc'].fullpath)
278 # test check_poolfile()
279 self.assertEqual((True, self.file['sl_3.03-16.dsc']), \
280 check_poolfile('main/s/sl/sl_3.03-16.dsc', 0, '', \
281 contrib.location_id, self.session))
282 self.assertEqual((False, None), \
283 check_poolfile('foobar', 0, '', contrib.location_id, self.session))
284 self.assertEqual((False, self.file['sl_3.03-16.dsc']), \
285 check_poolfile('main/s/sl/sl_3.03-16.dsc', 42, '', \
286 contrib.location_id, self.session))
287 self.assertEqual((False, self.file['sl_3.03-16.dsc']), \
288 check_poolfile('main/s/sl/sl_3.03-16.dsc', 0, 'deadbeef', \
289 contrib.location_id, self.session))
290 # test get_poolfile_like_name()
291 self.assertEqual([self.file['sl_3.03-16.dsc']], \
292 get_poolfile_like_name('sl_3.03-16.dsc', self.session))
293 self.assertEqual([], get_poolfile_like_name('foobar', self.session))
295 def test_maintainers(self):
297 tests relation between Maintainer and DBSource
299 TODO: add relations to changes_pending_source
302 maintainer = self.maintainer['maintainer']
303 self.assertEqual(maintainer,
304 self.session.query(Maintainer).get(maintainer.maintainer_id))
305 uploader = self.maintainer['uploader']
306 self.assertEqual(uploader,
307 self.session.query(Maintainer).get(uploader.maintainer_id))
308 lazyguy = self.maintainer['lazyguy']
309 self.assertEqual(lazyguy,
310 self.session.query(Maintainer).get(lazyguy.maintainer_id))
311 self.assertEqual(4, len(maintainer.maintains_sources))
312 self.assertTrue(self.source['hello_2.2-2'] in maintainer.maintains_sources)
313 self.assertEqual(maintainer.changed_sources, [])
314 self.assertEqual(uploader.maintains_sources, [])
315 self.assertEqual(4, len(uploader.changed_sources))
316 self.assertTrue(self.source['sl_3.03-16'] in uploader.changed_sources)
317 self.assertEqual(lazyguy.maintains_sources, [])
318 self.assertEqual(lazyguy.changed_sources, [])
320 def get_source_in_suite_fail(self):
322 This function throws the MultipleResultsFound exception because
323 get_source_in_suite is broken.
325 TODO: fix get_source_in_suite
328 return get_source_in_suite('hello', 'sid', self.session)
330 def test_sources(self):
331 'test relation between DBSource and PoolFile or Suite'
334 self.assertEqual(self.file['hello_2.2-2.dsc'], self.source['hello_2.2-2'].poolfile)
335 self.assertEqual(self.source['hello_2.2-2'], self.file['hello_2.2-2.dsc'].source)
336 self.assertEqual(None, self.file['python2.6_2.6.6-8.dsc'].source)
338 squeeze = self.session.query(Suite). \
339 filter(Suite.sources.contains(self.source['sl_3.03-16'])). \
340 order_by(Suite.suite_name)[1]
341 self.assertEqual(self.suite['squeeze'], squeeze)
342 self.assertEqual(1, squeeze.sources.count())
343 self.assertEqual(self.source['sl_3.03-16'], squeeze.sources[0])
344 sl = self.session.query(DBSource). \
345 filter(DBSource.suites.contains(self.suite['squeeze'])).one()
346 self.assertEqual(self.source['sl_3.03-16'], sl)
347 self.assertEqual(2, len(sl.suites))
348 self.assertTrue(self.suite['sid'] in sl.suites)
349 # test get_source_in_suite()
350 self.assertRaises(MultipleResultsFound, self.get_source_in_suite_fail)
351 self.assertEqual(None, \
352 get_source_in_suite('hello', 'squeeze', self.session))
353 self.assertEqual(self.source['sl_3.03-16'], \
354 get_source_in_suite('sl', 'sid', self.session))
355 # test get_suites_source_in()
356 self.assertEqual([self.suite['sid']], \
357 get_suites_source_in('hello', self.session))
358 self.assertEqual(2, len(get_suites_source_in('sl', self.session)))
359 self.assertTrue(self.suite['squeeze'] in \
360 get_suites_source_in('sl', self.session))
362 def test_add_dsc_to_db(self):
363 'tests function add_dsc_to_db()'
366 pkg.dsc['source'] = 'hello'
367 pkg.dsc['version'] = '2.2-3'
368 pkg.dsc['maintainer'] = self.maintainer['maintainer'].name
369 pkg.changes['changed-by'] = self.maintainer['uploader'].name
370 pkg.changes['fingerprint'] = 'deadbeef'
371 pkg.changes['distribution'] = { 'sid': '' }
372 pkg.files['hello_2.2-3.dsc'] = { \
374 'location id': self.loc['main'].location_id,
375 'files id': self.file['hello_2.2-3.dsc'].file_id }
378 (source, dsc_component, dsc_location_id, pfs) = \
379 add_dsc_to_db(upload, 'hello_2.2-3.dsc', self.session)
380 self.assertEqual('hello', source.source)
381 self.assertEqual('2.2-3', source.version)
382 self.assertEqual('sid', source.suites[0].suite_name)
383 self.assertEqual('main', dsc_component)
384 self.assertEqual(self.loc['main'].location_id, dsc_location_id)
385 self.assertEqual([], pfs)
387 def test_source_exists(self):
388 'test function source_exists()'
390 hello = self.source['hello_2.2-2']
391 self.assertTrue(source_exists(hello.source, hello.version, \
392 suites = ['sid'], session = self.session))
394 self.assertTrue(source_exists(hello.source, hello.version + '+b7', \
395 suites = ['sid'], session = self.session))
396 self.assertTrue(not source_exists(hello.source, hello.version, \
397 suites = ['lenny', 'squeeze'], session = self.session))
398 self.assertTrue(not source_exists(hello.source, hello.version, \
399 suites = ['lenny', 'sid'], session = self.session))
400 self.assertTrue(not source_exists(hello.source, hello.version, \
401 suites = ['sid', 'lenny'], session = self.session))
402 self.assertTrue(not source_exists(hello.source, '0815', \
403 suites = ['sid'], session = self.session))
405 self.assertTrue(source_exists(hello.source, hello.version, \
406 session = self.session))
408 def test_package_to_suite(self):
409 'test function package_to_suite()'
412 pkg.changes = { 'distribution': {} }
414 self.assertTrue(not package_to_suite(upload, 'sid', self.session))
415 pkg.changes['distribution'] = { 'sid': '' }
416 pkg.changes['architecture'] = { 'source': '' }
417 self.assertTrue(package_to_suite(upload, 'sid', self.session))
418 pkg.changes['architecture'] = {}
419 pkg.changes['source'] = self.source['hello_2.2-2'].source
420 pkg.changes['version'] = self.source['hello_2.2-2'].version
421 self.assertTrue(not package_to_suite(upload, 'sid', self.session))
422 pkg.changes['version'] = '42'
423 self.assertTrue(package_to_suite(upload, 'sid', self.session))
424 pkg.changes['source'] = 'foobar'
425 pkg.changes['version'] = self.source['hello_2.2-2'].version
426 self.assertTrue(package_to_suite(upload, 'sid', self.session))
427 pkg.changes['distribution'] = { 'lenny': '' }
428 self.assertTrue(package_to_suite(upload, 'lenny', self.session))
430 def test_get_newest_source(self):
431 'test function get_newest_source()'
434 daklib.queue.dm_suites = ['sid']
435 self.assertEqual(self.source['hello_2.2-2'], get_newest_source('hello', self.session))
436 self.assertEqual(None, get_newest_source('foobar', self.session))
438 def test_get_suite_version_by_source(self):
439 'test function get_suite_version_by_source()'
441 result = get_suite_version_by_source('hello', self.session)
442 self.assertEqual(2, len(result))
443 self.assertTrue(('sid', '2.2-1') in result)
444 self.assertTrue(('sid', '2.2-2') in result)
445 result = get_suite_version_by_source('sl', self.session)
446 self.assertEqual(2, len(result))
447 self.assertTrue(('squeeze', '3.03-16') in result)
448 self.assertTrue(('sid', '3.03-16') in result)
450 def test_binaries(self):
452 tests class DBBinary; TODO: test relation with Architecture, Maintainer,
453 PoolFile, and Fingerprint
456 # test Suite relation
457 self.assertEqual(3, self.suite['sid'].binaries.count())
458 self.assertTrue(self.binary['hello_2.2-1_i386'] in \
459 self.suite['sid'].binaries.all())
460 self.assertEqual(0, self.suite['lenny'].binaries.count())
461 # test DBSource relation
462 self.assertEqual(3, len(self.source['hello_2.2-1'].binaries))
463 self.assertTrue(self.binary['hello_2.2-1_i386'] in \
464 self.source['hello_2.2-1'].binaries)
465 self.assertEqual(0, len(self.source['hello_2.2-2'].binaries))
466 # test get_suites_binary_in()
467 self.assertEqual(2, len(get_suites_binary_in('hello', self.session)))
468 self.assertTrue(self.suite['sid'] in \
469 get_suites_binary_in('hello', self.session))
470 self.assertEqual(2, len(get_suites_binary_in('gnome-hello', self.session)))
471 self.assertTrue(self.suite['squeeze'] in \
472 get_suites_binary_in('gnome-hello', self.session))
473 self.assertEqual(0, len(get_suites_binary_in('sl', self.session)))
475 def test_add_deb_to_db(self):
476 'tests function add_deb_to_db()'
479 pkg.changes['fingerprint'] = 'deadbeef'
480 pkg.changes['distribution'] = { 'sid': '' }
481 pkg.files['hello_2.2-2_i386.deb'] = { \
484 'maintainer': self.maintainer['maintainer'].name,
485 'architecture': 'i386',
487 'pool name': 'main/h/hello/',
488 'location id': self.loc['main'].location_id,
489 'source package': 'hello',
490 'source version': '2.2-2',
492 'md5sum': 'deadbeef',
493 'sha1sum': 'deadbeef',
494 'sha256sum': 'deadbeef'}
496 poolfile = add_deb_to_db(upload, 'hello_2.2-2_i386.deb', self.session)
497 self.session.refresh(poolfile)
498 self.session.refresh(poolfile.binary)
499 self.assertEqual('main/h/hello/hello_2.2-2_i386.deb', poolfile.filename)
500 self.assertEqual('hello', poolfile.binary.package)
501 self.assertEqual('2.2-2', poolfile.binary.version)
502 self.assertEqual(['sid'], poolfile.binary.suites)
503 self.assertEqual('Mr. Maintainer', poolfile.binary.maintainer.name)
504 self.assertEqual('i386', poolfile.binary.architecture.arch_string)
505 self.assertEqual('deb', poolfile.binary.binarytype)
506 self.assertEqual(self.loc['main'], poolfile.location)
507 self.assertEqual(self.source['hello_2.2-2'], poolfile.binary.source)
508 self.assertEqual(0, poolfile.filesize)
509 self.assertEqual('deadbeef', poolfile.md5sum)
510 self.assertEqual('deadbeef', poolfile.sha1sum)
511 self.assertEqual('deadbeef', poolfile.sha256sum)
513 def test_get_source_by_package_and_suite(self):
514 'test get_source_by_package_and_suite()'
516 query = get_source_by_package_and_suite('hello', 'sid', self.session)
517 self.assertEqual(self.source['hello_2.2-1'], query.one())
518 query = get_source_by_package_and_suite('gnome-hello', 'squeeze', self.session)
519 self.assertEqual(self.source['hello_2.2-1'], query.one())
520 query = get_source_by_package_and_suite('hello', 'hamm', self.session)
521 self.assertEqual(0, query.count())
522 query = get_source_by_package_and_suite('foobar', 'squeeze', self.session)
523 self.assertEqual(0, query.count())
525 def test_get_suite_version_by_package(self):
526 'test function get_suite_version_by_package()'
528 result = get_suite_version_by_package('hello', 'i386', self.session)
529 self.assertEqual(2, len(result))
530 self.assertTrue(('sid', '2.2-1') in result)
531 result = get_suite_version_by_package('hello', 'amd64', self.session)
532 self.assertEqual(0, len(result))
533 result = get_suite_version_by_package('python-hello', 'i386', self.session)
534 self.assertEqual([('squeeze', '2.2-1')], result)
535 result = get_suite_version_by_package('python-hello', 'amd64', self.session)
536 self.assertEqual([('squeeze', '2.2-1')], result)
538 def test_components(self):
539 'test class Component'
541 self.assertEqual(self.loc['main'], self.comp['main'].location)
542 self.assertEqual(self.loc['contrib'], self.comp['contrib'].location)
544 def test_get_component_by_package_suite(self):
545 'test get_component_by_package_suite()'
547 result = get_component_by_package_suite('hello', ['sid'], self.session)
548 self.assertEqual('main', result)
549 result = get_component_by_package_suite('hello', ['hamm'], self.session)
550 self.assertEqual(None, result)
551 result = get_component_by_package_suite('foobar', ['sid'], self.session)
552 self.assertEqual(None, result)
553 # test that the newest version is returend
554 result = get_component_by_package_suite('gnome-hello', ['squeeze'], self.session)
555 self.assertEqual('main', result)
556 result = get_component_by_package_suite('gnome-hello', ['sid'], self.session)
557 self.assertEqual('contrib', result)
559 if __name__ == '__main__':