annotate MoinMoin/_tests/test_wikisync.py @ 6082:2e2f7c6f39eb

add CHANGES entry for additional abuse logging
author 'Karl O. Pinc' <kop@meme.com>
date Wed, 17 Sep 2014 08:17:15 -0500
parents 48f3e2ab7365
children
rev   line source
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
2 """
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
3 MoinMoin - MoinMoin.wikisync tests
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
5 @copyright: 2006 MoinMoin:AlexanderSchremmer
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
6 @license: GNU GPL, see COPYING for details.
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
7 """
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
8
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
9 import py
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
10
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
11 from MoinMoin.PageEditor import PageEditor
1270
db1811c83ccc Fixed test for wikisync.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1047
diff changeset
12 from MoinMoin.wikisync import TagStore, BOTH
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
13
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
14
2819
48f3e2ab7365 tests: convert wikisync tests to py.test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2448
diff changeset
15 class TestUnsafeSync(object):
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
16 """ Tests various things related to syncing. Note that it is not possible
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
17 to create pages without cluttering page revision currently, so we have to use
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
18 the testwiki. """
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
19
2819
48f3e2ab7365 tests: convert wikisync tests to py.test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2448
diff changeset
20 def setup_method(self, method):
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
21 if not getattr(self.request.cfg, 'is_test_wiki', False):
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
22 py.test.skip('This test needs to be run using the test wiki.')
1047
51086fe55b58 Added clearing to the TagStore, use it in the test.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1037
diff changeset
23 self.page = PageEditor(self.request, "FrontPage")
1037
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
24
e52ab62b3a0a Added test for wikisync.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
25 def testBasicTagThings(self):
1047
51086fe55b58 Added clearing to the TagStore, use it in the test.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1037
diff changeset
26 tags = TagStore(self.page)
2819
48f3e2ab7365 tests: convert wikisync tests to py.test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2448
diff changeset
27 assert not tags.get_all_tags()
1272
e85ad6a95ae5 Documented new ideas in the docstring, changed tag format (store normalised name), transmit normalised name in mergeDiff.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1270
diff changeset
28 tags.add(remote_wiki="foo", remote_rev=1, current_rev=2, direction=BOTH, normalised_name="FrontPage")
1047
51086fe55b58 Added clearing to the TagStore, use it in the test.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1037
diff changeset
29 tags = TagStore(self.page) # reload
1329
4a8c4849d162 Got syncing working with pages that are just in one wiki.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1272
diff changeset
30 dummy = repr(tags.get_all_tags()) # this should not raise
2819
48f3e2ab7365 tests: convert wikisync tests to py.test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2448
diff changeset
31 assert tags.get_all_tags()[0].remote_rev == 1
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2246
diff changeset
32
2819
48f3e2ab7365 tests: convert wikisync tests to py.test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2448
diff changeset
33 def teardown_method(self, method):
1047
51086fe55b58 Added clearing to the TagStore, use it in the test.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1037
diff changeset
34 tags = TagStore(self.page)
51086fe55b58 Added clearing to the TagStore, use it in the test.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1037
diff changeset
35 tags.clear()
2246
0893eaf60bbf Added legacy warning to test_wikisync, fixed packages test by deleting the page, gaining enough permissions before trying so and checking for the output pagename in the messages (this was added by reimar in 10c60d1131dd.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2006
diff changeset
36
2448
c9949c55ff5e add coverage_modules attribute for coverage testing
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2286
diff changeset
37 coverage_modules = ['MoinMoin.wikisync']
c9949c55ff5e add coverage_modules attribute for coverage testing
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2286
diff changeset
38