def setUp(self): logging.basicConfig() log = logging.getLogger() log.setLevel(logging.WARN) context = ContextWS("https://dev.bblearn.nau.edu") success = context.loginTool("NAU", "PythonFeed", "********") if not success: log.error("Login was not successful!") self.fail("Login was not successful!") self.userws = context.getUserWS() self.userName = ''.join( random.choice(string.letters) for i in xrange(5)) self.userName = string.lower(self.userName) ## Create user to play with user = self.userws.createSimpleUser(True, self.userName, "7777777" + self.userName, "*****@*****.**", "familyName", "givenName", "FORMER_STUDENT", "STUDENT") self.assertTrue(user) self.beforeAsync = -1 self.afterAsync = -1 self.callbackTime = -1
def setUp(self): logging.basicConfig() log=logging.getLogger() log.setLevel(logging.WARN) context = ContextWS("https://dev.bblearn.nau.edu") success = context.loginTool("NAU", "PythonFeed", "********") if not success: log.error("Login was not successful!") self.fail("Login was not successful!") self.userws = context.getUserWS() self.userName = ''.join(random.choice(string.letters) for i in xrange(5)) self.userName = string.lower(self.userName) ## Create user to play with user = self.userws.createSimpleUser(True, self.userName, "7777777" + self.userName, "*****@*****.**", "familyName" , "givenName", "FORMER_STUDENT","STUDENT") self.assertTrue(user) self.beforeAsync=-1 self.afterAsync=-1 self.callbackTime=-1
def setUp(self): logging.basicConfig() log = logging.getLogger() log.setLevel(logging.WARN) context = ContextWS("https://dev.bblearn.nau.edu") success = context.loginTool("NAU", "PythonFeed", "*****") if not success: log.error("Login was not successful!") self.fail("Login was not successful!") self.coursews = context.getCourseWS() self.random = string.lower(''.join( random.choice(string.letters) for i in xrange(5))) ## Create course to play with self.begin = datetime.date.today() self.end = datetime.date.today() + datetime.timedelta(days=1) self.courseid = self.coursews.createSimpleCourse( True, "batch" + self.random, # course batch id "course" + self.random, # course id "Testing " + self.random + " description", # description "name" + self.random, # course name time.mktime(self.begin.timetuple()), time.mktime(self.end.timetuple())) self.assertTrue(self.courseid) ## Create Category to play with self.categoryId = self.coursews.createSimpleCourseCategory( "category" + self.random, #name "catBatch" + self.random, #id "Testing category" + self.random + " description", #Description True) self.assertTrue(self.categoryId) ## Create Child Category to play with categoryVO = CategoryVO() categoryVO.available = True categoryVO.batchUid = "TestChild" + self.random categoryVO.description = "TestChild" + self.random categoryVO.frontPage = False categoryVO.title = "TestChild" + self.random categoryVO.parentId = self.categoryId self.childCategoryId = self.coursews.saveCourseCategory(categoryVO) self.assertTrue(self.childCategoryId) ## Assign category to course self.courseCategoryMembershipId = self.coursews.setCoursesMembership( self.courseid, self.categoryId, True) self.assertTrue(self.courseCategoryMembershipId)
def setUp(self): logging.basicConfig() log=logging.getLogger() log.setLevel(logging.WARN) context = ContextWS("https://dev.bblearn.nau.edu") success = context.loginTool("NAU", "PythonFeed", "*****") if not success: log.error("Login was not successful!") self.fail("Login was not successful!") self.coursews = context.getCourseWS() self.random = string.lower(''.join(random.choice(string.letters) for i in xrange(5))) ## Create course to play with self.begin = datetime.date.today() self.end = datetime.date.today()+datetime.timedelta(days=1) self.courseid = self.coursews.createSimpleCourse(True, "batch"+self.random, # course batch id "course"+self.random, # course id "Testing " + self.random + " description", # description "name"+self.random, # course name time.mktime(self.begin.timetuple()), time.mktime(self.end.timetuple())) self.assertTrue(self.courseid) ## Create Category to play with self.categoryId = self.coursews.createSimpleCourseCategory( "category"+self.random, #name "catBatch"+self.random, #id "Testing category" + self.random + " description", #Description True) self.assertTrue(self.categoryId) ## Create Child Category to play with categoryVO=CategoryVO() categoryVO.available=True categoryVO.batchUid="TestChild"+self.random categoryVO.description="TestChild"+self.random categoryVO.frontPage=False categoryVO.title="TestChild"+self.random categoryVO.parentId=self.categoryId self.childCategoryId = self.coursews.saveCourseCategory(categoryVO) self.assertTrue(self.childCategoryId) ## Assign category to course self.courseCategoryMembershipId = self.coursews.setCoursesMembership(self.courseid, self.categoryId, True) self.assertTrue(self.courseCategoryMembershipId)
def setUp(self): logging.basicConfig() log=logging.getLogger() log.setLevel(logging.WARN) context = ContextWS("https://dev.bblearn.nau.edu") success = context.loginTool("NAU", "PythonFeed", "*****") if not success: log.error("Login was not successful!") self.fail("Login was not successful!") self.userws = context.getUserWS() self.coursews = context.getCourseWS() self.courseMembershipWs = context.getCourseMembershipWS() self.random = string.lower(''.join(random.choice(string.letters) for i in xrange(5))) ## Create user to play with self.userId = self.userws.createSimpleUser(True, self.random, "7777777" + self.random, "*****@*****.**", "familyName" , "givenName") self.assertTrue(self.userId) ## Create course to play with self.begin = datetime.date.today() self.end = datetime.date.today()+datetime.timedelta(days=1) self.courseid = self.coursews.createSimpleCourse(True, "batch"+self.random, # course batch id "course"+self.random, # course id "Testing " + self.random + " description", # description "name"+self.random, # course name time.mktime(self.begin.timetuple()), time.mktime(self.end.timetuple())) self.assertTrue(self.courseid) ## Enroll user in class membership = CourseMembershipVO() membership.available=True membership.courseId=self.courseid membership.roleId="S" membership.userId=self.userId self.memberships = self.courseMembershipWs.saveCourseMemberships(self.courseid, [membership]) self.assertTrue(self.memberships)
"Course.WS:getCourse", "Course.WS:saveCourse", "Course.WS:deleteCourse", "Course.WS:getCategories", "Course.WS:getCourseCategoryMembership", "Course.WS:saveCourseCategory", "Course.WS:saveCourseCategoryMembership", "Course.WS:deleteCourseCategory", "Course.WS:deleteCourseCategoryMembership", "Course.WS:initializeCourseWS", "CourseMembership.WS:getCourseMembership", "CourseMembership.WS:saveCourseMembership", "CourseMembership.WS:initializeCourseMembershipWS", "user.authinfo" ] success = context.registerTool("NAU", "PythonFeed", "*****", "PythonFeed", toolMethods, None) else: success = context.loginTool("NAU", "PythonFeed", "lemtein") if not success: log.error("Login was not successful!") sys.exit() #userws = context.getUserWS() courseWs = context.getCourseWS() userWs = context.getUserWS() courseMembershipWs = context.getCourseMembershipWS() course = courseWs.getCourseByBatchId( "1107-NAU00-NUR-424-SEC801-11685.NAU-PSSIS") memberships = courseMembershipWs.getCourseMembershipsByCourse(course) user = userWs.getUserByUserId("cdg2") membership = CourseMembershipVO() for membership in memberships:
"Course.WS:saveCourseCategoryMembership", "Course.WS:deleteCourseCategory", "Course.WS:deleteCourseCategoryMembership", "Course.WS:initializeCourseWS", "CourseMembership.WS:getCourseMembership", "CourseMembership.WS:saveCourseMembership", "CourseMembership.WS:initializeCourseMembershipWS", "user.authinfo"] success = context.registerTool("NAU", "PythonFeed", "*****", "PythonFeed", toolMethods, None) else: success = context.loginTool("NAU", "PythonFeed", "lemtein") if not success: log.error("Login was not successful!") sys.exit() #userws = context.getUserWS() courseWs = context.getCourseWS() userWs = context.getUserWS() courseMembershipWs = context.getCourseMembershipWS() course = courseWs.getCourseByBatchId("1107-NAU00-NUR-424-SEC801-11685.NAU-PSSIS") memberships = courseMembershipWs.getCourseMembershipsByCourse(course) user = userWs.getUserByUserId("cdg2") membership = CourseMembershipVO()