Skip to content

Commit 694bf16

Browse files
committed
A basic set of tests for admin.py. Triggered by
https://issues.roundup-tracker.org/issue2551042
1 parent ad58fee commit 694bf16

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

test/test_admin.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#
2+
# Copyright (C) 2007 Stefan Seefeld
3+
# All rights reserved.
4+
# For license terms see the file COPYING.txt.
5+
#
6+
7+
from __future__ import print_function
8+
import unittest, os, shutil, errno, sys, difflib, cgi, re
9+
10+
from roundup.admin import AdminTool
11+
12+
from . import db_test_base
13+
from .test_mysql import skip_mysql
14+
from .test_postgresql import skip_postgresql
15+
16+
17+
class AdminTest(object):
18+
19+
backend = None
20+
21+
def setUp(self):
22+
self.dirname = '_test_admin'
23+
24+
def tearDown(self):
25+
try:
26+
shutil.rmtree(self.dirname)
27+
except OSError as error:
28+
if error.errno not in (errno.ENOENT, errno.ESRCH): raise
29+
30+
def testInit(self):
31+
import sys
32+
self.admin=AdminTool()
33+
sys.argv=['main', '-i', '_test_admin', 'install', 'classic', self.backend]
34+
ret = self.admin.main()
35+
print(ret)
36+
self.assertTrue(ret == 0)
37+
self.assertTrue(os.path.isfile(self.dirname + "/config.ini"))
38+
self.assertTrue(os.path.isfile(self.dirname + "/schema.py"))
39+
40+
41+
42+
class anydbmAdminTest(AdminTest, unittest.TestCase):
43+
backend = 'anydbm'
44+
45+
46+
@skip_mysql
47+
class mysqlAdminTest(AdminTest, unittest.TestCase):
48+
backend = 'mysql'
49+
50+
51+
class sqliteAdminTest(AdminTest, unittest.TestCase):
52+
backend = 'sqlite'
53+
54+
55+
@skip_postgresql
56+
class postgresqlAdminTest(AdminTest, unittest.TestCase):
57+
backend = 'postgresql'

0 commit comments

Comments
 (0)