source: tagsplugin/trunk/tractags/tests/util.py

Last change on this file was 16943, checked in by Ryan J Ollos, 6 years ago

TracTags 0.10dev: Make compatible with Trac 1.3.3dev

Fixes #13316.

File size: 1009 bytes
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
9import shutil
10import tempfile
11import unittest
12
13from trac.test import EnvironmentStub
14
15from tractags.util import MockReq
16
17
18class 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
35def test_suite():
36    suite = unittest.TestSuite()
37    suite.addTest(unittest.makeSuite(MockReqTestCase))
38    return suite
39
40
41if __name__ == '__main__':
42    unittest.main(defaultTest='test_suite')
Note: See TracBrowser for help on using the repository browser.