]> err.no Git - dak/commitdiff
Start new PackageTestCase.
authorTorsten Werner <twerner@debian.org>
Sat, 15 Jan 2011 23:26:22 +0000 (00:26 +0100)
committerTorsten Werner <twerner@debian.org>
Sat, 15 Jan 2011 23:26:22 +0000 (00:26 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
daklib/dbconn.py
tests/dbtest_packages.py [new file with mode: 0755]

index 0db4caf1be04dd28809d9bea116df1267ae04c87..4abfcc596f934fdefa52b4381d26a9e147bfc4f7 100755 (executable)
@@ -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 (executable)
index 0000000..0df6eb2
--- /dev/null
@@ -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()