Ejemplo n.º 1
0
def test_project_create():
    # login user get token
    user = User()
    user.login('test_user','test_pass')
    api_key = user.user.auth_token 
    # do a post
    url = '/api/project/?api_key=%s' % api_key
    # now check project in user
    test_client = webapp.app.test_client()
    data = {'name':'project create','description':'project content create'}
    
    result = test_client.post(url,data=json.dumps(data),content_type='application/json')
    status = json.loads(result.data)
    assert status['status']
    project = ProjectList()
    test_user = User()
    test_user.login('test_user','test_pass')
    print test_user.user.project
    registered = False
    for i in project.all():
        if i.get_id() in test_user.get_project():
            registered = True
    assert registered, "project not in user project"
       
    exist = False
    for i in project.all():
        
        if 'project create' == i.project.name:
            exist = True
    assert exist, "project created"
    
    # now delete it
    project = Project()
    model = MongoModel(project=project.project_,collection=project.collection_)
    model.delete({'name':'project create'})
Ejemplo n.º 2
0
def index():
    if current_user.is_authenticated():
        username = current_user.user.username
    else:
        username = "******"
    projects = ProjectList()

    project_list = projects.list()
    return render_template("main_page.html",username=username,projects=project_list)
Ejemplo n.º 3
0
def run_exporter(exporter):
    project_list = ProjectList()
    for project in project_list.all():
        exporter = exporter(project)
        exporter.run()