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.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: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: if membership.userId == user.id: membership.available = True membership.userId = user.id membership.roleId = "B" courseMembershipWs.saveCourseMemberships( course.id, memberships)
"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: if membership.userId == user.id: membership.available=True membership.userId=user.id membership.roleId="B" courseMembershipWs.saveCourseMemberships(course.id, memberships)