示例#1
0
 def testRemoveAccess(self):
     # self.createPanePlot()
     Access.give_access(self.account_id_one, self.account_id_two, PermissionsTest.FILE_NAME)
     Access.remove_access(self.account_id_one, PermissionsTest.FILE_NAME)
     shared_doc = Document.select_shared_files(self.account_id_two)
     # Now file is removed from shared.
     self.assertEqual(shared_doc, [])
示例#2
0
 def testGiveAccess(self):
     # self.createPanePlot()
     Access.give_access(self.account_id_one, self.account_id_two, PermissionsTest.FILE_NAME)
     # Then check retrieval.
     shared_doc = Document.select_shared_files(self.account_id_two)[0]
     # User 2 has none
     result = LR.get_user_regressions(self.account_id_two)
     self.assertEqual(shared_doc.file_name, PermissionsTest.FILE_NAME)
     self.assertEqual(shared_doc.account_id, self.account_id_one)
     self.assertEqual(result, [])
示例#3
0
文件: views.py 项目: noriakioji/QADDA
def get_panes_data(acct_id):
    """
    Fetches relevant data needed for template rendering on GET request
    :return: dict
    """
    documents = Document.select_user_files(acct_id)
    shared_files = Document.select_shared_files(acct_id)
    user_name = Account.objects.get(id=acct_id).username
    upload = DocumentForm()
    form = CreateForm()
    panes = compute_views.handle_get_panes(acct_id)
    return {
        "user_name": user_name,
        "documents": documents,
        "shared_documents": shared_files,
        "form": form,
        "panes": panes,
        "upload": upload,
    }
示例#4
0
 def testClearAccess(self):
     Access.give_access(self.account_id_one, self.account_id_two, PermissionsTest.FILE_NAME)
     Access.clear_accesses()
     shared_doc = Document.select_shared_files(self.account_id_two)
     self.assertEqual(shared_doc, [])