Example #1
0
def test_activate():
    sudo('rm -rf /home/woven/example.com')
    set_server_state('deployed_project_example_project-0.1',delete=True)
    set_server_state('created_virtualenv_example_project-0.1', delete=True)
    
    sudo('rm -rf /home/woven/workon-example_project')
    
    mkvirtualenv()
    deploy_project()
    
    activate()
Example #2
0
def test_deploy_project():
    #setup to ensure nothing left from a previous run
    change_version('0.2','0.1')
    run('rm -rf /home/woven/example.com')
    set_server_state('deployed_project_example_project-0.1',delete=True)
    set_server_state('deployed_project_example_project-0.2',delete=True)
    local('rm -rf example_project/sitesettings')
    
    #tests
    deploy_project()
    assert exists('/home/woven/example.com/env/example_project-0.1/project/setup.py')
    assert exists('/home/woven/example.com/env/example_project-0.1/project/example_project/sitesettings/example_com.py')
    assert contains('from example_project.settings import','/home/woven/example.com/env/example_project-0.1/project/example_project/sitesettings/example_com.py')
    #make sure we can't overwrite an existing project
    p = deploy_project()
    assert not p
    
    #Test patch
    
    #teardown
    p = Project()
    p.delete()
    
    #Next test to ensure .pyc orphans are not left
    deploy_project()
    run('touch /home/woven/example.com/env/example_project-0.1/project/example_project/someorphan.pyc')
    set_server_state('deployed_project_example_project-0.1',delete=True)
    deploy_project()
    assert not exists('/home/woven/example.com/env/example_project-0.1/project/example_project/someorphan.pyc')
    
    #Test a 2nd version deployment
    print "TEST 2ND DEPLOYMENT"
    run('ln -s /home/woven/example.com/env/example_project-0.1/ /home/woven/example.com/env/example_project')   
    change_version('0.1','0.2')
    
    deploy_project(version='0.2')
    assert exists('/home/woven/example.com/env/example_project-0.2/project/setup.py')
    
    #Teardown one project at a time
    p = Project()
    p.delete()    
    assert exists('/home/woven/example.com/env/example_project-0.1/project/setup.py')
    change_version('0.2','0.1')
    p = Project(version='0.1')
    p.delete()
    
    local('rm -rf example_project/sitesettings')