| Line | |
|---|
| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | # |
|---|
| 3 | # Copyright (C) 2014 Steffen Hoffmann <hoff.st@web.de> |
|---|
| 4 | # |
|---|
| 5 | # This software is licensed as described in the file COPYING, which |
|---|
| 6 | # you should have received as part of this distribution. |
|---|
| 7 | # |
|---|
| 8 | |
|---|
| 9 | import shutil |
|---|
| 10 | import tempfile |
|---|
| 11 | import unittest |
|---|
| 12 | |
|---|
| 13 | from trac.test import EnvironmentStub |
|---|
| 14 | |
|---|
| 15 | from tractags.util import MockReq |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | class MockReqTestCase(unittest.TestCase): |
|---|
| 19 | |
|---|
| 20 | def setUp(self): |
|---|
| 21 | self.env = EnvironmentStub(enable=['trac.*', 'tractags.*']) |
|---|
| 22 | self.env.path = tempfile.mkdtemp() |
|---|
| 23 | |
|---|
| 24 | def tearDown(self): |
|---|
| 25 | shutil.rmtree(self.env.path) |
|---|
| 26 | |
|---|
| 27 | def test_init(self): |
|---|
| 28 | req = MockReq() |
|---|
| 29 | self.assertTrue(req.args.get('something') is None) |
|---|
| 30 | req = MockReq(authname='user') |
|---|
| 31 | self.assertEqual('user', req.authname) |
|---|
| 32 | self.assertTrue(req.is_authenticated) |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | def test_suite(): |
|---|
| 36 | suite = unittest.TestSuite() |
|---|
| 37 | suite.addTest(unittest.makeSuite(MockReqTestCase)) |
|---|
| 38 | return suite |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | if __name__ == '__main__': |
|---|
| 42 | unittest.main(defaultTest='test_suite') |
|---|
Note: See
TracBrowser
for help on using the repository browser.