Пример #1
0
    def test_remediation_request(self):
        remediation = request_email_remediation('<message_id>', '<recipient@localhost>',
                                                saq.test.UNITTEST_USER_ID, saq.COMPANY_ID)
        self.assertTrue(isinstance(remediation, Remediation))
        remediation = saq.db.query(Remediation).filter(Remediation.id == remediation.id).one()
        self.assertIsNotNone(remediation)
        self.assertEquals(remediation.type, REMEDIATION_TYPE_EMAIL)
        self.assertEquals(remediation.action, REMEDIATION_ACTION_REMOVE)
        self.assertIsNotNone(remediation.insert_date)
        self.assertEquals(remediation.user_id, saq.test.UNITTEST_USER_ID)
        self.assertEquals(remediation.key, create_email_remediation_key('<message_id>', '<recipient@localhost>'))
        self.assertIsNone(remediation.result)
        self.assertIsNone(remediation.comment)
        self.assertIsNone(remediation.successful)
        self.assertEquals(remediation.company_id, saq.COMPANY_ID)
        self.assertIsNone(remediation.lock)
        self.assertIsNone(remediation.lock_time)
        self.assertEquals(remediation.status, REMEDIATION_STATUS_NEW)

        remediation = request_email_restoration('<message_id>', '<recipient@localhost>',
                                                saq.test.UNITTEST_USER_ID, saq.COMPANY_ID)
        self.assertTrue(isinstance(remediation, Remediation))
        remediation = saq.db.query(Remediation).filter(Remediation.id == remediation.id).one()
        self.assertIsNotNone(remediation)
        self.assertEquals(remediation.action, REMEDIATION_ACTION_RESTORE)
Пример #2
0
 def remediation_key(self):
     return create_email_remediation_key(self.message_id,
                                         self.email_address)