From: Torsten Werner Date: Sat, 15 Jan 2011 23:26:22 +0000 (+0100) Subject: Start new PackageTestCase. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a99beb83431df83aedea355d915d8a776cced0a3;p=dak Start new PackageTestCase. Signed-off-by: Torsten Werner --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 0db4caf1..4abfcc59 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -147,8 +147,9 @@ __all__.append('session_wrapper') ################################################################################ class Architecture(object): - def __init__(self, *args, **kwargs): - pass + def __init__(self, arch_string = None, description = None): + self.arch_string = arch_string + self.description = description def __eq__(self, val): if isinstance(val, str): diff --git a/tests/dbtest_packages.py b/tests/dbtest_packages.py new file mode 100755 index 00000000..0df6eb29 --- /dev/null +++ b/tests/dbtest_packages.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +from db_test import DBDakTestCase + +from daklib.dbconn import Architecture, Suite + +import unittest + +class PackageTestCase(DBDakTestCase): + """ + xxx + """ + + def setup_architectures(self): + "setup a hash of Architecture objects in self.arch" + + self.arch = {} + for arch_string in ('source', 'all', 'i386', 'amd64'): + self.arch[arch_string] = Architecture(arch_string) + # hard code ids for source and all + self.arch['source'].arch_id = 1 + self.arch['all'].arch_id = 2 + for _, architecture in self.arch.items(): + self.session.add(architecture) + self.session.flush() + self.session.refresh(architecture) + + def setUp(self): + super(PackageTestCase, self).setUp() + self.setup_architectures() + + def test_packages(self): + self.assertEqual(1, self.arch['source'].arch_id) + self.assertEqual(2, self.arch['all'].arch_id) + +if __name__ == '__main__': + unittest.main()