Show More
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -49,10 +49,10 b' def load_environment(global_conf, app_co' | |||||
49 |
|
49 | |||
50 | #sets the c attribute access when don't existing attribute are accessed |
|
50 | #sets the c attribute access when don't existing attribute are accessed | |
51 | config['pylons.strict_tmpl_context'] = True |
|
51 | config['pylons.strict_tmpl_context'] = True | |
52 |
|
52 | test = os.path.split(config['__file__'])[-1] == 'tests.ini' | ||
53 | #MULTIPLE DB configs |
|
53 | #MULTIPLE DB configs | |
54 | # Setup the SQLAlchemy database engine |
|
54 | # Setup the SQLAlchemy database engine | |
55 |
if config['debug'] and o |
|
55 | if config['debug'] and not test: | |
56 | #use query time debugging. |
|
56 | #use query time debugging. | |
57 | from pylons_app.lib.timerproxy import TimerProxy |
|
57 | from pylons_app.lib.timerproxy import TimerProxy | |
58 | sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', |
|
58 | sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', |
@@ -88,6 +88,7 b' class ChangesetController(BaseController' | |||||
88 | def raw_changeset(self,revision): |
|
88 | def raw_changeset(self,revision): | |
89 |
|
89 | |||
90 | hg_model = HgModel() |
|
90 | hg_model = HgModel() | |
|
91 | method = request.GET.get('diff','show') | |||
91 | try: |
|
92 | try: | |
92 | c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision) |
|
93 | c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision) | |
93 | except RepositoryError: |
|
94 | except RepositoryError: | |
@@ -125,7 +126,8 b' class ChangesetController(BaseController' | |||||
125 | c.changes.append(('changed', node, diff, cs1, cs2)) |
|
126 | c.changes.append(('changed', node, diff, cs1, cs2)) | |
126 |
|
127 | |||
127 | response.content_type = 'text/plain' |
|
128 | response.content_type = 'text/plain' | |
128 |
|
129 | if method == 'download': | ||
|
130 | response.content_disposition = 'attachment; filename=%s.patch' % revision | |||
129 | parent = True if len(c.changeset.parents) > 0 else False |
|
131 | parent = True if len(c.changeset.parents) > 0 else False | |
130 | c.parent_tmpl = 'Parent %s' % c.changeset.parents[0]._hex if parent else '' |
|
132 | c.parent_tmpl = 'Parent %s' % c.changeset.parents[0]._hex if parent else '' | |
131 |
|
133 |
@@ -23,6 +23,18 b'' | |||||
23 | ${self.breadcrumbs()} |
|
23 | ${self.breadcrumbs()} | |
24 | </div> |
|
24 | </div> | |
25 | <div class="table"> |
|
25 | <div class="table"> | |
|
26 | <div id="body" class="diffblock"> | |||
|
27 | <div class="code-header"> | |||
|
28 | <div> | |||
|
29 | ${_('Changeset')} - r${c.changeset.revision}:${c.changeset.raw_id} | |||
|
30 | » <span>${h.link_to(_('raw diff'), | |||
|
31 | h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</span> | |||
|
32 | » <span>${h.link_to(_('download diff'), | |||
|
33 | h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</span> | |||
|
34 | </div> | |||
|
35 | </div> | |||
|
36 | </div> | |||
|
37 | ||||
26 | <div id="changeset_content"> |
|
38 | <div id="changeset_content"> | |
27 | <div class="container"> |
|
39 | <div class="container"> | |
28 | <div class="left"> |
|
40 | <div class="left"> |
@@ -1,5 +1,5 b'' | |||||
1 | # HG changeset patch |
|
1 | # HG changeset patch | |
2 | # User ${c.changeset.author} |
|
2 | # User ${c.changeset.author|n} | |
3 | # Date ${"%d %d" % c.changeset._ctx.date()} |
|
3 | # Date ${"%d %d" % c.changeset._ctx.date()} | |
4 | # Node ID ${c.changeset._hex} |
|
4 | # Node ID ${c.changeset._hex} | |
5 | # ${c.parent_tmpl} |
|
5 | # ${c.parent_tmpl} |
@@ -31,7 +31,6 b' class TestController(TestCase):' | |||||
31 | wsgiapp = pylons.test.pylonsapp |
|
31 | wsgiapp = pylons.test.pylonsapp | |
32 | config = wsgiapp.config |
|
32 | config = wsgiapp.config | |
33 | self.app = TestApp(wsgiapp) |
|
33 | self.app = TestApp(wsgiapp) | |
34 | self.session = session |
|
|||
35 | url._push_object(URLGenerator(config['routes.map'], environ)) |
|
34 | url._push_object(URLGenerator(config['routes.map'], environ)) | |
36 | self.sa = meta.Session |
|
35 | self.sa = meta.Session | |
37 | TestCase.__init__(self, *args, **kwargs) |
|
36 | TestCase.__init__(self, *args, **kwargs) |
@@ -1,4 +1,7 b'' | |||||
1 | from pylons_app.tests import * |
|
1 | from pylons_app.tests import * | |
|
2 | from pylons_app.lib.indexers import IDX_LOCATION | |||
|
3 | import os | |||
|
4 | from nose.plugins.skip import SkipTest | |||
2 |
|
5 | |||
3 | class TestSearchController(TestController): |
|
6 | class TestSearchController(TestController): | |
4 |
|
7 | |||
@@ -10,6 +13,17 b' class TestSearchController(TestControlle' | |||||
10 | # Test response... |
|
13 | # Test response... | |
11 |
|
14 | |||
12 | def test_empty_search(self): |
|
15 | def test_empty_search(self): | |
|
16 | ||||
|
17 | if os.path.isdir(IDX_LOCATION): | |||
|
18 | raise SkipTest('skipped due to existing index') | |||
|
19 | else: | |||
13 | self.log_user() |
|
20 | self.log_user() | |
14 | response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'}) |
|
21 | response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'}) | |
15 | assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index' No newline at end of file |
|
22 | assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index' | |
|
23 | ||||
|
24 | def test_normal_search(self): | |||
|
25 | self.log_user() | |||
|
26 | response = self.app.get(url(controller='search', action='index'),{'q':'def+repo'}) | |||
|
27 | print response.body | |||
|
28 | assert '9 results' in response.body,'no message about proper search results' | |||
|
29 |
@@ -8,7 +8,8 b' from time import mktime' | |||||
8 | import logging |
|
8 | import logging | |
9 | import os |
|
9 | import os | |
10 | import sys |
|
10 | import sys | |
11 |
import |
|
11 | import tarfile | |
|
12 | ||||
12 | log = logging.getLogger(__name__) |
|
13 | log = logging.getLogger(__name__) | |
13 |
|
14 | |||
14 | ROOT = dn(dn(os.path.realpath(__file__))) |
|
15 | ROOT = dn(dn(os.path.realpath(__file__))) | |
@@ -28,8 +29,10 b' def setup_app(command, conf, vars):' | |||||
28 |
|
29 | |||
29 | if not os.path.isdir(REPO_TEST_PATH): |
|
30 | if not os.path.isdir(REPO_TEST_PATH): | |
30 | os.mkdir(REPO_TEST_PATH) |
|
31 | os.mkdir(REPO_TEST_PATH) | |
31 | from_ = '/home/marcink/workspace-python/vcs' |
|
32 | cur_dir = dn(os.path.abspath(__file__)) | |
32 | shutil.copytree(from_, os.path.join(REPO_TEST_PATH,'vcs_test')) |
|
33 | tar = tarfile.open(jn(cur_dir,'tests',"vcs_test.tar.gz")) | |
|
34 | tar.extractall(REPO_TEST_PATH) | |||
|
35 | tar.close() | |||
33 |
|
36 | |||
34 | tests = True |
|
37 | tests = True | |
35 |
|
38 |
General Comments 0
You need to be logged in to leave comments.
Login now