Changeset - 7f4943c90876
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-02-01 02:16:27
marcin@python-works.com
fixed test hg operations script
1 file changed with 10 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/test_hg_operations.py
Show inline comments
 
@@ -64,32 +64,36 @@ class Command(object):
 

	
 
def get_session():
 
    engine = engine_from_config(conf, 'sqlalchemy.db1.')
 
    init_model(engine)
 
    sa = meta.Session()
 
    return sa
 

	
 

	
 
def create_test_user(force=True):
 
    sa = get_session()
 

	
 
    user = sa.query(User).filter(User.username == USER).scalar()
 
    if force:
 

	
 
    if force and user:
 
        sa.delete(user)
 
        sa.commit()
 

	
 
    if user is None or force:
 
        new_usr = User()
 
        new_usr.username = USER
 
        new_usr.password = get_crypt_password(PASS)
 
        new_usr.email = 'mail@mail.com'
 
        new_usr.name = 'test'
 
        new_usr.lastname = 'lasttestname'
 
        new_usr.active = True
 

	
 
        sa.add(new_usr)
 
        sa.commit()
 

	
 

	
 

	
 

	
 
#==============================================================================
 
# TESTS
 
#==============================================================================
 
def test_clone():
 
@@ -249,23 +253,24 @@ def test_push_wrong_path():
 
    clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s' % \
 
                  {'user':USER,
 
                   'pass':PASS,
 
                   'host':HOST,
 
                   'cloned_repo':HG_REPO + '_error',
 
                   'dest':jn(TESTS_TMP_PATH, HG_REPO)}
 

	
 
    stdout, stderr = Command(cwd).execute('hg push %s' % clone_url)
 
    assert """abort: HTTP Error 403: Forbidden"""  in stderr
 

	
 

	
 
if __name__ == '__main__':
 
    create_test_user()
 
    #test_clone()
 
    #create_test_user()
 
    test_clone()
 
    test_clone_anonymous_ok()
 

	
 
    #test_clone_wrong_credentials()
 
    ##test_clone_anonymous_ok()
 

	
 
    #test_pull()
 
    test_push_new_file(3)
 
    #test_push_new_file(3)
 
    #test_push_wrong_path()
 
    #test_push_wrong_credentials()
 

	
 

	
0 comments (0 inline, 0 general)