Mercurial > wikked
comparison tests/__init__.py @ 49:fb6ae96756c1
Added unit tests.
Refactored core APIs to make them more testable.
Removed unused stuff like caching the configuration in the SQL database.
Fixed the web bootstrap.
Some cosmetic changes to be PEP8 compliant.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 28 Jan 2013 23:13:04 -0800 |
parents | |
children | 2733871775cd |
comparison
equal
deleted
inserted
replaced
48:9658edea3121 | 49:fb6ae96756c1 |
---|---|
1 import os | |
2 import os.path | |
3 import shutil | |
4 import unittest | |
5 from wikked.wiki import Wiki | |
6 from mock import MockWikiParameters | |
7 | |
8 | |
9 class WikkedTest(unittest.TestCase): | |
10 def setUp(self): | |
11 self.root = os.path.join( | |
12 os.path.dirname(os.path.dirname(__file__)), | |
13 'test_data') | |
14 | |
15 def tearDown(self): | |
16 if hasattr(self, 'root') and os.path.isdir(self.root): | |
17 shutil.rmtree(self.root) | |
18 | |
19 def getWiki(self, **kwargs): | |
20 parameters = self.getParameters() | |
21 for key in kwargs: | |
22 setattr(parameters, key, kwargs[key]) | |
23 wiki = Wiki(parameters) | |
24 return wiki | |
25 | |
26 def getStartedWiki(self, **kwargs): | |
27 wiki = self.getWiki(**kwargs) | |
28 wiki.start() | |
29 return wiki | |
30 | |
31 def getParameters(self): | |
32 return MockWikiParameters() |