コード例 #1
0
ファイル: test_tip.py プロジェクト: rowanthorpe/GLBackend
    def access_receivers_tip(self):

        auth1 = yield authentication.login_receiver(self.receiver1_desc['username'], STATIC_PASSWORD)
        self.assertEqual(auth1, self.receiver1_desc['receiver_gus'])

        auth2 = yield authentication.login_receiver(self.receiver2_desc['username'], STATIC_PASSWORD)
        self.assertEqual(auth2, self.receiver2_desc['receiver_gus'])

        # we does not know the association auth# sefl.rtip#_id
        # so we need a double try catch for each check and we need to store the proper association
        tmp1 = self.rtip1_id
        tmp2 = self.rtip2_id
        try:
            self.receiver1_data = yield tip.get_internaltip_receiver(auth1, tmp1)
        except:
            try:
                self.rtip1_id = tmp2
                self.rtip2_id = tmp1
                self.receiver1_data = yield tip.get_internaltip_receiver(auth1, tmp2)
            except Exception as e:
                self.assertTrue(False)
                raise e
        
        self.assertEqual(self.receiver1_data['fields'], self.submission_desc['wb_fields'])
        self.assertTrue(self.receiver1_data['im_receiver'])
        self.assertFalse(self.receiver1_data['im_whistleblower'])

        self.receiver2_data = yield tip.get_internaltip_receiver(auth2, self.rtip2_id)

        self.assertEqual(self.receiver2_data['fields'], self.submission_desc['wb_fields'])
        self.assertTrue(self.receiver2_data['im_receiver'])
        self.assertFalse(self.receiver2_data['im_whistleblower'])
コード例 #2
0
ファイル: test_tip.py プロジェクト: rowanthorpe/GLBackend
    def success_postpone_expiration_date(self):
        """
        Tests with receiver1 and update with receiver2 is equal
        to use the the same receiver
        """
        tip_expiring = yield tip.get_internaltip_receiver(
            self.receiver1_desc['receiver_gus'], self.rtip1_id)

        yield tip.postpone_expiration_date(
                    self.receiver2_desc['receiver_gus'],
                    self.rtip2_id)

        tip_extended = yield tip.get_internaltip_receiver(
            self.receiver1_desc['receiver_gus'], self.rtip1_id)

        self.assertNotEqual(tip_expiring['expiration_date'], tip_extended['expiration_date'])
コード例 #3
0
ファイル: test_tip.py プロジェクト: rowanthorpe/GLBackend
    def fail_postpone_expiration_date(self):
        tip_expiring = yield tip.get_internaltip_receiver(
            self.receiver1_desc['receiver_gus'], self.rtip1_id)

        try:
            yield tip.postpone_expiration_date(
                    self.receiver2_desc['receiver_gus'],
                    self.rtip2_id)
        except errors.ExtendTipLifeNotEnabled:
            self.assertTrue(True)
        except Exception, e:
            self.assertTrue(False)
            raise e
コード例 #4
0
ファイル: test_tip.py プロジェクト: rowanthorpe/GLBackend
    def strong_receiver_auth(self):
        """
        Test that an authenticated Receiver1 can't access to the Tip generated for Rcvr2
        """

        # Instead of yield authentication.login_receiver(username/pasword), is used:
        auth_receiver_1 = self.receiver1_desc['receiver_gus']

        try:
            yield tip.get_internaltip_receiver(auth_receiver_1, self.rtip2_id)
            self.assertTrue(False)
        except errors.TipGusNotFound, e:
            self.assertTrue(True)
コード例 #5
0
ファイル: test_tip.py プロジェクト: rowanthorpe/GLBackend
    def receiver1_total_delete_tip(self):

        yield tip.delete_internal_tip(self.receiver1_desc['receiver_gus'],
            self.rtip1_id)

        try:
            # just one operation that fail if iTip is invalid
            yield tip.get_internaltip_receiver(
                        self.receiver1_desc['receiver_gus'], self.rtip1_id)
            self.assertTrue(False)
        except errors.TipGusNotFound:
            self.assertTrue(True)
        except Exception, e:
            self.assertTrue(False)
            raise e
コード例 #6
0
ファイル: test_tip.py プロジェクト: rowanthorpe/GLBackend
    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
        potential_expiration_date : 2014-05-19 21:22:16.677997
        expiration_date : 2014-05-19T21:22:14.481711
        """
        context_list = yield admin.get_context_list()
        self.assertTrue(isinstance(context_list, list))
        self.assertEqual(len(context_list), 1)
        tip_ttl = context_list[0]['tip_timetolive']

        tip_expiring = yield tip.get_internaltip_receiver(
            self.receiver1_desc['receiver_gus'], self.rtip1_id)

        creation_date = vptd_dirty_copy(tip_expiring['creation_date'])
        potential_exp_date = vptd_dirty_copy(tip_expiring['potential_expiration_date'])
        expiration_date = vptd_dirty_copy(tip_expiring['expiration_date'])
コード例 #7
0
ファイル: test_tip.py プロジェクト: rowanthorpe/GLBackend
    @inlineCallbacks
    def fail_postpone_expiration_date(self):
        tip_expiring = yield tip.get_internaltip_receiver(
            self.receiver1_desc['receiver_gus'], self.rtip1_id)

        try:
            yield tip.postpone_expiration_date(
                    self.receiver2_desc['receiver_gus'],
                    self.rtip2_id)
        except errors.ExtendTipLifeNotEnabled:
            self.assertTrue(True)
        except Exception, e:
            self.assertTrue(False)
            raise e

        tip_not_extended = yield tip.get_internaltip_receiver(
            self.receiver1_desc['receiver_gus'], self.rtip1_id)

        self.assertEqual(tip_expiring['expiration_date'], tip_not_extended['expiration_date'])

    @inlineCallbacks
    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
        potential_expiration_date : 2014-05-19 21:22:16.677997
        expiration_date : 2014-05-19T21:22:14.481711
        """
        context_list = yield admin.get_context_list()
        self.assertTrue(isinstance(context_list, list))
        self.assertEqual(len(context_list), 1)