Changeset - 6dee43453f58
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 14 years ago 2011-06-29 01:09:44
marcin@python-works.com
added test for non ascii repositories and fixed users_groups test
2 files changed with 40 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/functional/test_admin_repos.py
Show inline comments
 
# -*- coding: utf-8 -*-
 

	
 
import os
 
import vcs
 

	
 
@@ -30,11 +32,8 @@ class TestAdminReposController(TestContr
 
                                                'repo_group':'',
 
                                                'description':description,
 
                                                'private':private})
 
        self.assertTrue('flash' in response.session)
 

	
 
        #test if we have a message for that repository
 
        self.assertTrue('''created repository %s''' % (repo_name) in
 
                        response.session['flash'][0])
 
        self.checkSessionFlash(response, 'created repository %s' % (repo_name))
 

	
 
        #test if the repo was created in the database
 
        new_repo = self.sa.query(Repository).filter(Repository.repo_name ==
 
@@ -56,6 +55,42 @@ class TestAdminReposController(TestContr
 
            self.fail('no repo in filesystem')
 

	
 

	
 
    def test_create_hg_non_ascii(self):
 
        self.log_user()
 
        non_ascii = "ąęł"
 
        repo_name = "%s%s" % (NEW_HG_REPO, non_ascii)
 
        repo_name_unicode = repo_name.decode('utf8')
 
        description = 'description for newly created repo' + non_ascii
 
        description_unicode = description.decode('utf8')
 
        private = False
 
        response = self.app.post(url('repos'), {'repo_name':repo_name,
 
                                                'repo_type':'hg',
 
                                                'clone_uri':'',
 
                                                'repo_group':'',
 
                                                'description':description,
 
                                                'private':private})
 
        self.checkSessionFlash(response,
 
                               'created repository %s' % (repo_name_unicode))
 

	
 
        #test if the repo was created in the database
 
        new_repo = self.sa.query(Repository).filter(Repository.repo_name ==
 
                                                repo_name_unicode).one()
 

	
 
        self.assertEqual(new_repo.repo_name, repo_name_unicode)
 
        self.assertEqual(new_repo.description, description_unicode)
 

	
 
        #test if repository is visible in the list ?
 
        response = response.follow()
 

	
 
        self.assertTrue(repo_name in response.body)
 

	
 
        #test if repository was created on filesystem
 
        try:
 
            vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name))
 
        except:
 
            self.fail('no repo in filesystem')
 

	
 

	
 
    def test_create_hg_in_group(self):
 
        #TODO: write test !
 
        pass
rhodecode/tests/functional/test_admin_users_groups.py
Show inline comments
 
@@ -12,6 +12,7 @@ class TestAdminUsersGroupsController(Tes
 
        response = self.app.get(url('formatted_users_groups', format='xml'))
 

	
 
    def test_create(self):
 
        self.log_user()
 
        users_group_name = TEST_USERS_GROUP
 
        response = self.app.post(url('users_groups'),
 
                                 {'users_group_name':users_group_name,
0 comments (0 inline, 0 general)