コード例 #1
0
def addExampleAttachment(content=None):
    """Returns a tuple of the Resource ID, and then potentially the actual
    ContentResource object"""
    content_srv = ComponentManager.get("org.sakaiproject.content.api.ContentHostingService")
    if content == None:
        payload = lorum_ipsum
    else:
        payload = content
    cres = content_srv.addAttachmentResource("tiitest","tiiintegrationtest",payload, None)
    return cres.id, cres
コード例 #2
0
def becomeUser(userEid="inst01"):
    """
    Some methods are keyed to depend on the current thread bound user. This will
    change the current thread to the userid passed in.
    
    If userid is None this will effectively clear the current session to no user
    is logged in.
    """
    session_mgr = ComponentManager.get("org.sakaiproject.tool.api.SessionManager")
    authz_srv = ComponentManager.get("org.sakaiproject.authz.api.AuthzGroupService")
    security_srv = ComponentManager.get("org.sakaiproject.authz.api.SecurityService")
    user_serv = ComponentManager.get("org.sakaiproject.user.api.UserDirectoryService")
    
    session = session_mgr.getCurrentSession()
    user = user_serv.getUserByEid(userEid)
    session.clear()
    session.setUserId(user.getId())
    session.setUserEid(user.getEid())
    authz_srv.refreshUser(user.getId())
コード例 #3
0
def createTestUsers():
    """
    This will create some users we can use for the tests.
    """
    user_serv = ComponentManager.get("org.sakaiproject.user.api.UserDirectoryService")
    
    users= []
    users.extend(test_inst_ids)
    users.extend(test_stud_ids)
    
    for i in users:
        try:
            user_serv.addUser(None,i,"First"+i,"Last"+i,i+"@sakaitest.org","tester",None,None)
        except:
            pass
コード例 #4
0
 def testEnrollInClass(self):
     """Integration Test for TurnitinReviewServiceImpl.enrollInClass
     TODO Change source code to make this test have better results to 
     verify against (ie. return the rMessage and rCode for instance)
     """
     user_serv = ComponentManager.get("org.sakaiproject.user.api.UserDirectoryService")
     tiiclassid = str(uuid.uuid1())
     tiiasnnid = str(uuid.uuid1())
     tiiemail = str(uuid.uuid1()) + "@sakaiproject.org"
     # SWG TODO Why does this fail if you create the Class first?
     self.tiireview_serv.createClass(tiiclassid)
     Thread.sleep(1000)
     self.tiireview_serv.createAssignment(tiiclassid, tiiasnnid )
     Thread.sleep(1000)
     self.tiireview_serv.enrollInClass(user_serv.getUserId("stud01"), 
                                     tiiemail, tiiclassid)
コード例 #5
0
def trySomething(*args):
    '''tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
    tiiasnnid = "/unittests/nothere/asdfaasdfsafd"
    tiireview_serv.createAssignment("tii-unit-test",
            tiiasnnid)
    tiireview_serv.createAssignment("tii-unit-test",
            tiiasnnid)
    '''
    content_id = "/attachment/27eb8fe5-10c0-4f70-9b8c-8031e0e6b851/Assignment2/fc263898-89ef-496c-b8ec-21e4d8c0e0f2/A2IT3_V4.pdf"
    tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
    #tiireview_serv.checkForReports()
    reviewURL = tiireview_serv.getReviewReportInstructor(content_id)
    print("Instructor URL")
    print(reviewURL)
    print("Student URL")
    studentReviewURL = tiireview_serv.getReviewReportStudent(content_id)
    print(studentReviewURL)
コード例 #6
0
 def testQueueContent(self):
     """Integration test for ContentReviewService.queueContent"""
     user_serv = ComponentManager.get("org.sakaiproject.user.api.UserDirectoryService")
     tiiclassid = str(uuid.uuid1())
     tiiasnnid = str(uuid.uuid1())
     tiiemail = str(uuid.uuid1()) + "@sakaiproject.org"
     userid = user_serv.getUserId("stud01")
     tiicontentid = addExampleAttachment()[0]
     #
     #self.tiireview_serv.createClass(tiiclassid)
     self.tiireview_serv.createAssignment(tiiclassid, tiiasnnid )
     Thread.sleep(1000)
     self.tiireview_serv.enrollInClass(userid, 
                                     tiiemail, tiiclassid)
     Thread.sleep(1000)
     self.tiireview_serv.queueContent(userid, tiiclassid, tiiasnnid, tiicontentid)
     #TODO Do the same thing the quartz job would
     self.tiireview_serv.processQueue()
     self.tiireview_serv.checkForReports()
     status = self.tiireview_serv.getReviewStatus(tiicontentid)
     self.log.warn("The status is: " + str(status))
     self.assert_(status in [ContentReviewItem.SUBMITTED_REPORT_AVAILABLE_CODE, ContentReviewItem.SUBMITTED_AWAITING_REPORT_CODE])
     self.assertNotEqual(status, ContentReviewItem.NOT_SUBMITTED_CODE)
コード例 #7
0
ファイル: src9.py プロジェクト: bgarciaentornos/turnitin
 def __init__(self):
     self.idmanager = ComponentManager.get("org.sakaiproject.id.api.IdManager")
コード例 #8
0
ファイル: src9.py プロジェクト: bgarciaentornos/turnitin
 def setUp(self):
     self.tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
コード例 #9
0
 def setUp(self):
     self.tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
コード例 #10
0
def checkForReports():
    tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
    tiireview_serv.checkForReports()
コード例 #11
0
def processQueue():
    tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
    tiireview_serv.processQueue()
コード例 #12
0
def viewAssignment(siteid,taskid):
    "Spits out the returned XML from the Turnitin View Asnn API Call"
    tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
    return tiireview_serv.getAssignment(siteid,taskid)
コード例 #13
0
 def __init__(self):
     self.idmanager = ComponentManager.get("org.sakaiproject.id.api.IdManager")
コード例 #14
0
 def setUp(self):
     self.tiireview_serv = ComponentManager.get("org.sakaiproject.contentreview.service.ContentReviewService")
     self.cachedSourceParameter = self.tiireview_serv.useSourceParameter
     self.tiireview_serv.useSourceParameter = self.useSourceParameter
     self.log = LogFactory.getLog("TestTurnitinReviewServiceImpl")
     self.user_serv = ComponentManager.get("org.sakaiproject.user.api.UserDirectoryService")