Example #1
0
    def fail_postpone_expiration_date(self):
        tip_expiring = yield rtip.get_rtip(
            self.receiver1_desc['id'], self.rtip1_id, 'en')

        yield self.assertFailure(rtip.postpone_expiration_date(
                                     self.receiver1_desc['id'],
                                     self.rtip1_id),
                                 errors.ExtendTipLifeNotEnabled)

        tip_not_postponeed = yield rtip.get_rtip(
            self.receiver1_desc['id'], self.rtip1_id, 'en')

        self.assertEqual(tip_expiring['expiration_date'], tip_not_postponeed['expiration_date'])
Example #2
0
    def test_keywords_conversion(self):
        yield self.perform_full_submission_actions()
        yield DeliverySchedule().run()

        data = {}
        data['type'] = 'tip'
        data['receiver'] = yield admin.receiver.get_receiver(
            self.dummyReceiver_1['id'], 'en')
        data['context'] = yield admin.context.get_context(
            self.dummyContext['id'], 'en')
        data['notification'] = yield admin.notification.get_notification('en')
        data['node'] = yield admin.node.admin_serialize_node('en')

        if self.dummyRTips[0]['receiver_id'] == self.dummyReceiver_1['id']:
            tip_id = self.dummyRTips[0]['id']
        else:
            tip_id = self.dummyRTips[1]['id']

        data['tip'] = yield rtip.get_rtip(self.dummyReceiver_1['id'], tip_id,
                                          'en')

        data['comment'] = data['tip']['comments'][0]
        data['message'] = data['tip']['messages'][0]

        files = yield rtip.get_files_receiver(self.dummyReceiver_1['id'],
                                              data['tip']['id'])
        data['file'] = files[0]

        for key in ['tip', 'comment', 'message', 'file']:
            data['type'] = key
            template = ''.join(supported_template_types[key].keyword_list)
            ret = Templating().format_template(template, data)
Example #3
0
    def test_keywords_conversion(self):
        yield self.perform_full_submission_actions()
        yield Delivery().run()

        data = {}
        data['type'] = 'tip'
        data['user'] = yield user.get_user(1, self.dummyReceiver_1['id'],
                                           u'en')
        data['context'] = yield admin.context.get_context(
            1, self.dummyContext['id'], u'en')
        data['notification'] = yield tw(admin.notification.db_get_notification,
                                        1, u'en')
        data['node'] = yield tw(admin.node.db_admin_serialize_node, 1, u'en')

        for tip in self.dummyRTips:
            if tip['receiver_id'] == self.dummyReceiver_1['id']:
                tip_id = tip['id']
                break

        data['tip'], _ = yield rtip.get_rtip(1, self.dummyReceiver_1['id'],
                                             tip_id, u'en')

        data['comments'] = data['tip']['comments']
        data['comment'] = data['comments'][0]

        data['messages'] = data['tip']['messages']
        data['message'] = data['messages'][0]

        files = yield rtip.receiver_get_rfile_list(data['tip']['id'])
        data['file'] = files[0]

        for key in ['tip', 'comment', 'message', 'file']:
            data['type'] = key
            template = ''.join(supported_template_types[key].keyword_list)
            Templating().format_template(template, data)
Example #4
0
    def success_postpone_expiration_date(self):
        """
        Tests with receiver1 and update with receiver2 is equal
        to use the the same receiver
        """
        tip_expiring = yield rtip.get_rtip(self.receiver1_desc['id'],
                                           self.rtip1_id, 'en')

        yield rtip.postpone_expiration_date(self.receiver2_desc['id'],
                                            self.rtip2_id)

        tip_postponeed = yield rtip.get_rtip(self.receiver1_desc['id'],
                                             self.rtip1_id, 'en')

        self.assertNotEqual(tip_expiring['expiration_date'],
                            tip_postponeed['expiration_date'])
Example #5
0
    def test_keywords_conversion(self):
        yield self.perform_full_submission_actions()
        yield DeliverySchedule().run()

        data = {}
        data['type'] = 'tip'
        data['receiver'] = yield admin.receiver.get_receiver(self.dummyReceiver_1['id'], 'en')
        data['context'] = yield admin.context.get_context(self.dummyContext['id'], 'en')
        data['notification'] = yield admin.notification.get_notification('en')
        data['node'] = yield admin.node.admin_serialize_node('en')

        if self.dummyRTips[0]['receiver_id'] == self.dummyReceiver_1['id']:
            tip_id = self.dummyRTips[0]['id']
        else:
            tip_id = self.dummyRTips[1]['id']

        data['tip'] = yield rtip.get_rtip(self.dummyReceiver_1['id'], tip_id, 'en')

        data['comment'] = data['tip']['comments'][0]
        data['message'] = data['tip']['messages'][0]

        files = yield rtip.receiver_get_rfile_list(data['tip']['id'])
        data['file'] = files[0]

        for key in ['tip', 'comment', 'message', 'file']:
            data['type'] = key
            template = ''.join(supported_template_types[key].keyword_list)
            ret = Templating().format_template(template, data)
Example #6
0
    def access_receivers_tip(self):
        auth1, _, _, _ = yield authentication.login(self.receiver1_desc['username'], helpers.VALID_PASSWORD1, False)
        self.assertEqual(auth1, self.receiver1_desc['id'])

        auth2, _, _, _ = yield authentication.login(self.receiver2_desc['username'], helpers.VALID_PASSWORD1, False)
        self.assertEqual(auth2, self.receiver2_desc['id'])

        for i in range(1, 2):
            self.receiver1_data = yield rtip.get_rtip(auth1, self.rtip1_id, 'en')
            self.assertEqual(self.receiver1_data['answers'], self.submission_desc['answers'])
            self.assertEqual(self.receiver1_data['access_counter'], i)

        for i in range(1, 2):
            self.receiver2_data = yield rtip.get_rtip(auth2, self.rtip2_id, 'en')
            self.assertEqual(self.receiver2_data['answers'], self.submission_desc['answers'])
            self.assertEqual(self.receiver2_data['access_counter'], i)
Example #7
0
    def success_postpone_expiration_date(self):
        """
        Tests with receiver1 and update with receiver2 is equal
        to use the the same receiver
        """
        tip_expiring = yield rtip.get_rtip(
            self.receiver1_desc['id'], self.rtip1_id, 'en')

        yield rtip.postpone_expiration_date(
                    self.receiver2_desc['id'],
                    self.rtip2_id)

        tip_postponeed = yield rtip.get_rtip(
            self.receiver1_desc['id'], self.rtip1_id, 'en')

        self.assertNotEqual(tip_expiring['expiration_date'], tip_postponeed['expiration_date'])
Example #8
0
    def test_keywords_conversion(self):
        yield self.perform_full_submission_actions()
        yield Delivery().run()

        data = {}
        data['type'] = 'tip'
        data['user'] = yield user.get_user(1, self.dummyReceiver_1['id'], u'en')
        data['context'] = yield admin.context.get_context(1, self.dummyContext['id'], u'en')
        data['notification'] = yield tw(admin.notification.db_get_notification, 1, u'en')
        data['node'] = yield tw(admin.node.db_admin_serialize_node, 1, u'en')

        for tip in self.dummyRTips:
            if tip['receiver_id'] == self.dummyReceiver_1['id']:
                tip_id = tip['id']
                break

        data['tip'], _ = yield rtip.get_rtip(1, self.dummyReceiver_1['id'], tip_id, u'en')

        data['comments'] = data['tip']['comments']
        data['comment'] = data['comments'][0]

        data['messages'] = data['tip']['messages']
        data['message'] = data['messages'][0]

        files = yield rtip.receiver_get_rfile_list(data['tip']['id'])
        data['file'] = files[0]

        for key in ['tip', 'comment', 'message', 'file']:
            data['type'] = key
            template = ''.join(supported_template_types[key].keyword_list)
            Templating().format_template(template, data)
Example #9
0
    def verify_other_receivers_could_not_access_the_the_same_tip(self):
        """
        Test that an authenticated Receiver1 can't access to the Tip generated for Rcvr2
        """
        auth_receiver_1 = self.receiver1_desc['id']

        yield self.assertFailure(rtip.get_rtip(auth_receiver_1, self.rtip2_id, 'en'),
                                 errors.TipIdNotFound)
Example #10
0
    def receiver1_delete_tip(self):
        yield rtip.delete_rtip(self.receiver1_desc['id'], self.rtip1_id)

        self.assertFailure(rtip.get_rtip(self.receiver1_desc['id'], self.rtip1_id, 'en'),
                           errors.TipIdNotFound)

        count = yield self.get_count_of_itip_using_archived_schema(self.rtip1_questionnaire_hash)
        self.assertEqual(count, 0)
Example #11
0
    def verify_default_expiration_date(self):
        """
        that's the date status in this test (tip ttl 200 days)

        creation_date : 2013-10-31T21:22:14.481809
        expiration_date : 2014-05-19T21:22:14.481711
        """
        context_list = yield admin.context.get_context_list('en')
        self.assertTrue(isinstance(context_list, list))
        self.assertEqual(len(context_list), 1)

        yield rtip.get_rtip(self.receiver1_desc['id'], self.rtip1_id, 'en')
Example #12
0
    def verify_default_expiration_date(self):
        """
        that's the date status in this test (tip ttl 200 days)

        creation_date : 2013-10-31T21:22:14.481809
        expiration_date : 2014-05-19T21:22:14.481711
        """
        context_list = yield admin.context.get_context_list('en')
        self.assertTrue(isinstance(context_list, list))
        self.assertEqual(len(context_list), 1)

        yield rtip.get_rtip(self.receiver1_desc['id'], self.rtip1_id, 'en')