當前位置: 首頁>>代碼示例>>Python>>正文


Python Project.get_id方法代碼示例

本文整理匯總了Python中project.model.Project.get_id方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.get_id方法的具體用法?Python Project.get_id怎麽用?Python Project.get_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在project.model.Project的用法示例。


在下文中一共展示了Project.get_id方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_update

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def test_update():
    user = User()
    user.login('test_user_api_update','test_pass')
    api_key = user.user.auth_token

    project = Project()
    project.find('test api update')
    entry_id = project.find_entry('test api entry')
    print user.get_project()
    print project.get_id()
    mongo = MongoModel(project='test_api_update',collection='test_api_entry')
    data = mongo.query({'a':1})
    print data
    id = str(data['_id'])
    updated = {'a':2}
    url = '/api/db/%s/%s/%s/?api_key=%s' % (project.project.id,entry_id,id,api_key) 
    
    client = webapp.app.test_client()
    response = client.put(url, data = json.dumps(updated),
            content_type='application/json')
    print response.data
    status = json.loads(response.data)
    
    assert status['status']
  
    updated_data = mongo.query({'_id':objectid.ObjectId(id)})
    assert updated_data['a'] == 2
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:29,代碼來源:test_api.py

示例2: setup_user_project_list

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def setup_user_project_list():
    user = User()
    user.create('test_user_list','test_pass','[email protected]')
    project = Project()
    project.create('project list 1','project content 1')
    user.add_project(project.get_id())
    project = Project()
    project.create('project list 2','project content 2')
    user.add_project(project.get_id())
    project = Project()
    project.create('project list 3','project content 3')
    user.add_project(project.get_id())
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:14,代碼來源:test_project_api.py

示例3: setup_user

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def setup_user():
    user = User()
    user.create('test_user','test_pass','[email protected]')
    project = Project()
    project.create('scraped','scraped')
    project.add_entry('entry','entry','localhost')
    user.add_project(project.get_id())
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:9,代碼來源:test_api.py

示例4: setup_project_update

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def setup_project_update():
    user = User()
    user.create('test_update_user','test_password','[email protected]')
    project = Project()
    project.create('project update','test project update')
    user.add_project(project.get_id())
    project.add_entry('data','test data','data')
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:9,代碼來源:test_project_frontend.py

示例5: setup_test_update

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def setup_test_update():
    mongo = MongoModel(project='test_api_update',collection='test_api_entry')
    mongo.insert({'a':1})
    user = User()
    user.create('test_user_api_update','test_pass','[email protected]')
    project = Project()
    project.create('test api update','scraped')
    project.add_entry('test api entry','entry','localhost')
    user.add_project(project.get_id())
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:11,代碼來源:test_api.py

示例6: setup_user_project

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def setup_user_project():
    # now create user
    user = User()
    user.create('test_user_update_project','test_pass','[email protected]') 
    # create project
    project = Project()
    project.create('project update','project update content')
    # associate project
    user.add_project(project.get_id())
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:11,代碼來源:test_project_api.py

示例7: test_user_project_withdraw

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def test_user_project_withdraw():
    user = User()
    user.login('test_user_list','test_pass') 
    project = Project()
    project.find('project list 3')

    user.add_project(project.get_id())
    api_key = user.user.auth_token
    test_client = webapp.app.test_client()

    url = '/api/project/%s/?api_key=%s' % (project.get_id(),api_key)
       
    data = {'project':'project_list_3','action':'withdraw'}

    result = test_client.put(url,data=json.dumps(data),content_type='application/json')
    print result.data 
    user.login('test_user_list','test_pass')
    print user.user.project
    print project.get_id()
    print project.project.name
    assert not str(project.get_id()) in user.user.project
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:23,代碼來源:test_project_api.py

示例8: test_project_delete

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def test_project_delete():
    # login user get token
    user = User()
    user.login('test_user_delete_api_project','test_pass')
    
    api_key = user.user.auth_token
    print api_key
    project = Project()
    project.find('project 1')
    project_id = project.get_id()
    # do a delete
    test_client = webapp.app.test_client()
    url = '/api/project/%s/?api_key=%s' % (project.project.id,api_key)
    result = test_client.delete(url)
    status = json.loads(result.data)
    # now check user don't exist
    project = Project()
    model = MongoModel(project=project.project_,collection=project.collection_)
    data = model.query({'name':'project 1'})
    assert not data

    test_user = User()
    test_user.login('test_user_delete','test_pass')
    assert project_id not in test_user.user.project
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:26,代碼來源:test_project_api.py

示例9: setup_project_delete

# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import get_id [as 別名]
def setup_project_delete():
    user = User()
    user.create('test_user_delete_api_project','test_pass','[email protected]')
    project = Project()
    project.create('project 1','project content 1')
    user.add_project(project.get_id())
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:8,代碼來源:test_project_api.py


注:本文中的project.model.Project.get_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。