Show More
@@ -1,3 +1,5 | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | ||||
1 | import os |
|
3 | import os | |
2 | import vcs |
|
4 | import vcs | |
3 |
|
5 | |||
@@ -30,11 +32,8 class TestAdminReposController(TestContr | |||||
30 | 'repo_group':'', |
|
32 | 'repo_group':'', | |
31 | 'description':description, |
|
33 | 'description':description, | |
32 | 'private':private}) |
|
34 | 'private':private}) | |
33 | self.assertTrue('flash' in response.session) |
|
|||
34 |
|
35 | |||
35 | #test if we have a message for that repository |
|
36 | self.checkSessionFlash(response, 'created repository %s' % (repo_name)) | |
36 | self.assertTrue('''created repository %s''' % (repo_name) in |
|
|||
37 | response.session['flash'][0]) |
|
|||
38 |
|
37 | |||
39 | #test if the repo was created in the database |
|
38 | #test if the repo was created in the database | |
40 | new_repo = self.sa.query(Repository).filter(Repository.repo_name == |
|
39 | new_repo = self.sa.query(Repository).filter(Repository.repo_name == | |
@@ -56,6 +55,42 class TestAdminReposController(TestContr | |||||
56 | self.fail('no repo in filesystem') |
|
55 | self.fail('no repo in filesystem') | |
57 |
|
56 | |||
58 |
|
57 | |||
|
58 | def test_create_hg_non_ascii(self): | |||
|
59 | self.log_user() | |||
|
60 | non_ascii = "ąęł" | |||
|
61 | repo_name = "%s%s" % (NEW_HG_REPO, non_ascii) | |||
|
62 | repo_name_unicode = repo_name.decode('utf8') | |||
|
63 | description = 'description for newly created repo' + non_ascii | |||
|
64 | description_unicode = description.decode('utf8') | |||
|
65 | private = False | |||
|
66 | response = self.app.post(url('repos'), {'repo_name':repo_name, | |||
|
67 | 'repo_type':'hg', | |||
|
68 | 'clone_uri':'', | |||
|
69 | 'repo_group':'', | |||
|
70 | 'description':description, | |||
|
71 | 'private':private}) | |||
|
72 | self.checkSessionFlash(response, | |||
|
73 | 'created repository %s' % (repo_name_unicode)) | |||
|
74 | ||||
|
75 | #test if the repo was created in the database | |||
|
76 | new_repo = self.sa.query(Repository).filter(Repository.repo_name == | |||
|
77 | repo_name_unicode).one() | |||
|
78 | ||||
|
79 | self.assertEqual(new_repo.repo_name, repo_name_unicode) | |||
|
80 | self.assertEqual(new_repo.description, description_unicode) | |||
|
81 | ||||
|
82 | #test if repository is visible in the list ? | |||
|
83 | response = response.follow() | |||
|
84 | ||||
|
85 | self.assertTrue(repo_name in response.body) | |||
|
86 | ||||
|
87 | #test if repository was created on filesystem | |||
|
88 | try: | |||
|
89 | vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) | |||
|
90 | except: | |||
|
91 | self.fail('no repo in filesystem') | |||
|
92 | ||||
|
93 | ||||
59 | def test_create_hg_in_group(self): |
|
94 | def test_create_hg_in_group(self): | |
60 | #TODO: write test ! |
|
95 | #TODO: write test ! | |
61 | pass |
|
96 | pass |
@@ -12,6 +12,7 class TestAdminUsersGroupsController(Tes | |||||
12 | response = self.app.get(url('formatted_users_groups', format='xml')) |
|
12 | response = self.app.get(url('formatted_users_groups', format='xml')) | |
13 |
|
13 | |||
14 | def test_create(self): |
|
14 | def test_create(self): | |
|
15 | self.log_user() | |||
15 | users_group_name = TEST_USERS_GROUP |
|
16 | users_group_name = TEST_USERS_GROUP | |
16 | response = self.app.post(url('users_groups'), |
|
17 | response = self.app.post(url('users_groups'), | |
17 | {'users_group_name':users_group_name, |
|
18 | {'users_group_name':users_group_name, |
General Comments 0
You need to be logged in to leave comments.
Login now