|
3 | 3 | from __future__ import absolute_import, division, print_function, unicode_literals |
4 | 4 |
|
5 | 5 | import math |
| 6 | +import os |
6 | 7 | import re |
| 8 | +import unittest |
7 | 9 | from unittest import TestCase |
8 | 10 |
|
9 | 11 | from atwiki.core import AtWikiAPI |
10 | 12 | from atwiki.uri import AtWikiURI |
11 | 13 |
|
12 | 14 | from . import TEST_BASE_URI |
13 | 15 |
|
| 16 | + |
| 17 | +skip_search_tests = os.environ.get('ATWIKI_TEST_SEARCH_SKIP', '1') == '1' |
| 18 | + |
| 19 | + |
14 | 20 | class AtWikiAPITest(TestCase): |
15 | 21 | def setUp(self): |
16 | 22 | self._api = AtWikiAPI(AtWikiURI(TEST_BASE_URI)) |
@@ -44,12 +50,14 @@ def test_get_source_special(self): |
44 | 50 | def test_get_source_invalid(self): |
45 | 51 | self.assertRaises(IndexError, self._api.get_source, 15, 100000) |
46 | 52 |
|
| 53 | + @unittest.skipIf(skip_search_tests, 'Skipping search tests') |
47 | 54 | def test_search(self): |
48 | 55 | results = list(self._api.search('SearchKeyword01 SearchKeyword02')) |
49 | 56 | self.assertEqual(len(results), 1) |
50 | 57 | self.assertEqual(results[0]['name'], 'Test_atwiki.test.test_core:AtWikiAPITest:test_search') |
51 | 58 | self.assertEqual(results[0]['snippet'], 'SearchKeyword01 SearchKeyword02') |
52 | 59 |
|
| 60 | + @unittest.skipIf(skip_search_tests, 'Skipping search tests') |
53 | 61 | def test_search_or(self): |
54 | 62 | results = list(self._api.search('SearchKeyword01 SearchKeyword02', False)) |
55 | 63 | self.assertEqual(len(results), 2) |
|
0 commit comments