Exemplo n.º 1
0
 def get_metadata(self):
     from sentry.interfaces.security import ExpectCT
     expectct = ExpectCT.to_python(self.data['expectct'])
     return {
         'origin': expectct.get_origin(),
         'message': expectct.get_message(),
     }
Exemplo n.º 2
0
 def test_invalid_format(self):
     interface = ExpectCT.to_python({
         'hostname': 'www.example.com',
         'date_time': 'Not an RFC3339 datetime'
     })
     # invalid keys are just removed
     assert interface.to_json() == {'hostname': 'www.example.com'}
Exemplo n.º 3
0
 def get_metadata(self, data):
     from sentry.interfaces.security import ExpectCT
     expectct = ExpectCT.to_python(data['expectct'])
     return {
         'origin': expectct.get_origin(),
         'message': expectct.get_message(),
     }
Exemplo n.º 4
0
 def test_invalid_format(self):
     interface = ExpectCT.to_python({
         'hostname': 'www.example.com',
         'date_time': 'Not an RFC3339 datetime'
     })
     # invalid keys are just removed
     assert interface.to_json() == {'hostname': 'www.example.com'}
Exemplo n.º 5
0
    def get_metadata(self, data):
        from sentry.interfaces.security import ExpectCT

        expectct = ExpectCT.to_python(data["expectct"])
        return {
            "origin": expectct.get_origin(),
            "message": expectct.get_message()
        }
Exemplo n.º 6
0
 def test_serialize_unserialize_behavior(self):
     assert ExpectCT.to_python(
         self.interface_json).to_json() == self.interface_json
Exemplo n.º 7
0
 def test_to_python(self):
     interface = ExpectCT.to_python(self.interface_json)
     assert interface.hostname == 'www.example.com'
     assert interface.date_time == '2014-04-06T13:00:50Z'
     assert interface.port == 443
     assert len(interface.served_certificate_chain) == 1
Exemplo n.º 8
0
 def test_from_raw(self):
     interface = ExpectCT.from_raw(self.raw_report)
     assert interface.hostname == 'www.example.com'
     assert interface.date_time == '2014-04-06T13:00:50Z'
     assert interface.port == 443
     assert len(interface.served_certificate_chain) == 1
Exemplo n.º 9
0
 def test_serialize_unserialize_behavior(self):
     assert ExpectCT.to_python(self.interface_json).to_json() == self.interface_json
Exemplo n.º 10
0
 def test_to_python(self):
     interface = ExpectCT.to_python(self.interface_json)
     assert interface.hostname == 'www.example.com'
     assert interface.date_time == '2014-04-06T13:00:50Z'
     assert interface.port == 443
     assert len(interface.served_certificate_chain) == 1
Exemplo n.º 11
0
 def test_from_raw(self):
     interface = ExpectCT.from_raw(self.raw_report)
     assert interface.hostname == 'www.example.com'
     assert interface.date_time == '2014-04-06T13:00:50Z'
     assert interface.port == 443
     assert len(interface.served_certificate_chain) == 1
Exemplo n.º 12
0
def test_from_raw(make_expectct_snapshot):
    make_expectct_snapshot(ExpectCT.from_raw(raw_report).to_json())
Exemplo n.º 13
0
def test_from_raw(make_expectct_snapshot):
    make_expectct_snapshot(ExpectCT.from_raw(raw_report).to_json())