Esempio n. 1
0
    def test_parse_audit_info_with_minimum_data(self):
        """Testing ConsentData.parse_audit_info with minimum required data"""
        consent_data = ConsentData.parse_audit_info('test-requirement', {
            'granted': False,
            'timestamp': '2018-01-02T13:14:15+00:00',
        })

        self.assertEqual(consent_data.requirement_id, 'test-requirement')
        self.assertFalse(consent_data.granted)
        self.assertEqual(consent_data.timestamp,
                         datetime(2018, 1, 2, 13, 14, 15, tzinfo=timezone.utc))
        self.assertIsNone(consent_data.source)
        self.assertIsNone(consent_data.extra_data)
Esempio n. 2
0
    def test_parse_audit_info_with_all_data(self):
        """Testing ConsentData.parse_audit_info with all data"""
        consent_data = ConsentData.parse_audit_info('test-requirement', {
            'granted': True,
            'timestamp': '2018-01-02T13:14:15+00:00',
            'source': 'http://example.com/account/profile/#consent',
            'extra_data': {
                'test': True,
            },
        })

        self.assertEqual(consent_data.requirement_id, 'test-requirement')
        self.assertTrue(consent_data.granted)
        self.assertEqual(consent_data.timestamp,
                         datetime(2018, 1, 2, 13, 14, 15, tzinfo=timezone.utc))
        self.assertEqual(consent_data.source,
                         'http://example.com/account/profile/#consent')
        self.assertEqual(
            consent_data.extra_data,
            {
                'test': True,
            })