Example #1
0
 def setUp(self):
     super(SignAndSendReplaceResultTest, self).setUp()
     self.course_key = CourseLocator(org='some_org',
                                     course='some_course',
                                     run='some_run')
     self.usage_key = BlockUsageLocator(course_key=self.course_key,
                                        block_type='problem',
                                        block_id='block_id')
     self.user = UserFactory.create()
     consumer = LtiConsumer(consumer_name='consumer',
                            consumer_key='consumer_key',
                            consumer_secret='secret')
     consumer.save()
     outcome = OutcomeService(
         lis_outcome_service_url='http://example.com/service_url',
         lti_consumer=consumer,
     )
     outcome.save()
     self.assignment = GradedAssignment(
         user=self.user,
         course_key=self.course_key,
         usage_key=self.usage_key,
         outcome_service=outcome,
         lis_result_sourcedid='sourcedid',
     )
     self.assignment.save()
Example #2
0
 def setUp(self):
     super(SignAndSendReplaceResultTest, self).setUp()
     self.course_key = CourseLocator(
         org='some_org',
         course='some_course',
         run='some_run'
     )
     self.usage_key = BlockUsageLocator(
         course_key=self.course_key,
         block_type='problem',
         block_id='block_id'
     )
     self.user = UserFactory.create()
     consumer = LtiConsumer(
         consumer_name='consumer',
         consumer_key='consumer_key',
         consumer_secret='secret'
     )
     consumer.save()
     outcome = OutcomeService(
         lis_outcome_service_url='http://example.com/service_url',
         lti_consumer=consumer,
     )
     outcome.save()
     self.assignment = GradedAssignment(
         user=self.user,
         course_key=self.course_key,
         usage_key=self.usage_key,
         outcome_service=outcome,
         lis_result_sourcedid='sourcedid',
     )
     self.assignment.save()
Example #3
0
    def setUp(self):
        super(BaseOutcomeTest, self).setUp()
        self.course_key = CourseLocator(org='some_org',
                                        course='some_course',
                                        run='some_run')
        self.usage_key = BlockUsageLocator(course_key=self.course_key,
                                           block_type='problem',
                                           block_id='block_id')
        self.user = UserFactory.create()
        self.consumer = LtiConsumer(consumer_name='Lti Consumer Name',
                                    consumer_key='consumer_key',
                                    consumer_secret='consumer_secret',
                                    instance_guid='tool_instance_guid')
        self.consumer.save()
        outcome = OutcomeService(
            lis_outcome_service_url='http://example.com/service_url',
            lti_consumer=self.consumer)
        outcome.save()
        self.assignment = GradedAssignment(
            user=self.user,
            course_key=self.course_key,
            usage_key=self.usage_key,
            outcome_service=outcome,
            lis_result_sourcedid='sourcedid',
            version_number=1,
        )
        self.assignment.save()

        self.send_score_update_mock = self.setup_patch(
            'lti_provider.outcomes.send_score_update', None)
Example #4
0
    def setUp(self):
        super(BaseOutcomeTest, self).setUp()
        self.course_key = CourseLocator(org="some_org", course="some_course", run="some_run")
        self.usage_key = BlockUsageLocator(course_key=self.course_key, block_type="problem", block_id="block_id")
        self.user = UserFactory.create()
        self.consumer = LtiConsumer(
            consumer_name="Lti Consumer Name",
            consumer_key="consumer_key",
            consumer_secret="consumer_secret",
            instance_guid="tool_instance_guid",
        )
        self.consumer.save()
        outcome = OutcomeService(lis_outcome_service_url="http://example.com/service_url", lti_consumer=self.consumer)
        outcome.save()
        self.assignment = GradedAssignment(
            user=self.user,
            course_key=self.course_key,
            usage_key=self.usage_key,
            outcome_service=outcome,
            lis_result_sourcedid="sourcedid",
            version_number=1,
        )
        self.assignment.save()

        self.send_score_update_mock = self.setup_patch("lti_provider.outcomes.send_score_update", None)
Example #5
0
 def setUp(self):
     super(SendOutcomeTest, self).setUp()
     self.course_key = CourseLocator(
         org='some_org',
         course='some_course',
         run='some_run'
     )
     self.usage_key = BlockUsageLocator(
         course_key=self.course_key,
         block_type='problem',
         block_id='block_id'
     )
     self.user = UserFactory.create()
     self.points_possible = 10
     self.points_earned = 3
     self.generate_xml_mock = self.setup_patch(
         'lti_provider.outcomes.generate_replace_result_xml',
         'replace result XML'
     )
     self.replace_result_mock = self.setup_patch(
         'lti_provider.outcomes.sign_and_send_replace_result',
         'replace result response'
     )
     self.check_result_mock = self.setup_patch(
         'lti_provider.outcomes.check_replace_result_response',
         True
     )
     consumer = LtiConsumer(
         consumer_name='Lti Consumer Name',
         consumer_key='consumer_key',
         consumer_secret='consumer_secret',
         instance_guid='tool_instance_guid'
     )
     consumer.save()
     outcome = OutcomeService(
         lis_outcome_service_url='http://example.com/service_url',
         lti_consumer=consumer
     )
     outcome.save()
     self.assignment = GradedAssignment(
         user=self.user,
         course_key=self.course_key,
         usage_key=self.usage_key,
         outcome_service=outcome,
         lis_result_sourcedid='sourcedid',
     )
     self.assignment.save()
Example #6
0
 def setUp(self):
     super(SendOutcomeTest, self).setUp()
     self.course_key = CourseLocator(
         org='some_org',
         course='some_course',
         run='some_run'
     )
     self.usage_key = BlockUsageLocator(
         course_key=self.course_key,
         block_type='problem',
         block_id='block_id'
     )
     self.user = UserFactory.create()
     self.points_possible = 10
     self.points_earned = 3
     self.generate_xml_mock = self.setup_patch(
         'lti_provider.outcomes.generate_replace_result_xml',
         'replace result XML'
     )
     self.replace_result_mock = self.setup_patch(
         'lti_provider.outcomes.sign_and_send_replace_result',
         'replace result response'
     )
     self.check_result_mock = self.setup_patch(
         'lti_provider.outcomes.check_replace_result_response',
         True
     )
     consumer = LtiConsumer(
         consumer_name='Lti Consumer Name',
         consumer_key='consumer_key',
         consumer_secret='consumer_secret',
         instance_guid='tool_instance_guid'
     )
     consumer.save()
     outcome = OutcomeService(
         lis_outcome_service_url='http://example.com/service_url',
         lti_consumer=consumer
     )
     outcome.save()
     self.assignment = GradedAssignment(
         user=self.user,
         course_key=self.course_key,
         usage_key=self.usage_key,
         outcome_service=outcome,
         lis_result_sourcedid='sourcedid',
     )
     self.assignment.save()
Example #7
0
 def create_outcome_service(self, id_suffix):
     """
     Create and save a new OutcomeService model in the test database. The
     OutcomeService model requires an LtiConsumer model, so we create one of
     those as well. The method takes an ID string that is used to ensure that
     unique fields do not conflict.
     """
     lti_consumer = LtiConsumer(
         consumer_name='lti_consumer_name' + id_suffix,
         consumer_key='lti_consumer_key' + id_suffix,
         consumer_secret='lti_consumer_secret' + id_suffix,
         instance_guid='lti_instance_guid' + id_suffix)
     lti_consumer.save()
     outcome_service = OutcomeService(
         lis_outcome_service_url='https://example.com/outcomes/' +
         id_suffix,
         lti_consumer=lti_consumer)
     outcome_service.save()
     return outcome_service
Example #8
0
 def create_outcome_service(self, id_suffix):
     """
     Create and save a new OutcomeService model in the test database. The
     OutcomeService model requires an LtiConsumer model, so we create one of
     those as well. The method takes an ID string that is used to ensure that
     unique fields do not conflict.
     """
     lti_consumer = LtiConsumer(
         consumer_name='lti_consumer_name' + id_suffix,
         consumer_key='lti_consumer_key' + id_suffix,
         consumer_secret='lti_consumer_secret' + id_suffix,
         instance_guid='lti_instance_guid' + id_suffix
     )
     lti_consumer.save()
     outcome_service = OutcomeService(
         lis_outcome_service_url='https://example.com/outcomes/' + id_suffix,
         lti_consumer=lti_consumer
     )
     outcome_service.save()
     return outcome_service
Example #9
0
    def setUp(self):
        super(BaseOutcomeTest, self).setUp()
        self.course_key = CourseLocator(
            org='some_org',
            course='some_course',
            run='some_run'
        )
        self.usage_key = BlockUsageLocator(
            course_key=self.course_key,
            block_type='problem',
            block_id='block_id'
        )
        self.user = UserFactory.create()
        self.consumer = LtiConsumer(
            consumer_name='Lti Consumer Name',
            consumer_key='consumer_key',
            consumer_secret='consumer_secret',
            instance_guid='tool_instance_guid'
        )
        self.consumer.save()
        outcome = OutcomeService(
            lis_outcome_service_url='http://example.com/service_url',
            lti_consumer=self.consumer
        )
        outcome.save()
        self.assignment = GradedAssignment(
            user=self.user,
            course_key=self.course_key,
            usage_key=self.usage_key,
            outcome_service=outcome,
            lis_result_sourcedid='sourcedid',
            version_number=1,
        )
        self.assignment.save()

        self.send_score_update_mock = self.setup_patch(
            'lti_provider.outcomes.send_score_update', None
        )