Esempio n. 1
0
 def test_string_data(self):
     result = Breadcrumbs.to_python(
         dict(values=[{
             'type': 'message',
             'timestamp': 1458857193.973275,
             'data': 'must be a mapping'
         }]))
     assert len(result.values) == 1
     assert not result.values[0].get('data')
Esempio n. 2
0
 def test_non_string_keys(self):
     result = Breadcrumbs.to_python(dict(values=[{
         'type': 'message',
         'timestamp': 1458857193.973275,
         'data': {
             'extra': {'foo': 'bar'},
         },
     }]))
     assert len(result.values) == 1
     assert result.values[0]['data'] == {'extra': '{"foo":"bar"}'}
Esempio n. 3
0
 def test_non_string_keys(self):
     result = Breadcrumbs.to_python(
         dict(values=[{
             'type': 'message',
             'timestamp': 1458857193.973275,
             'data': {
                 'extra': {
                     'foo': 'bar'
                 },
             },
         }]))
     assert len(result.values) == 1
     assert result.values[0]['data'] == {'extra': {"foo": "bar"}}
Esempio n. 4
0
 def test_simple(self):
     result = Breadcrumbs.to_python(dict(values=[{
         'type': 'message',
         'timestamp': 1458857193.973275,
         'data': {
             'message': 'Whats up dawg?',
         },
     }]))
     assert len(result.values) == 1
     assert result.values[0]['type'] == 'message'
     ts = result.values[0]['timestamp']
     assert int(ts) == 1458857193
     assert abs(ts - 1458857193.973275) < 0.001
     assert result.values[0]['data'] == {'message': 'Whats up dawg?'}
Esempio n. 5
0
 def test_string_data(self):
     result = Breadcrumbs.to_python(
         dict(
             values=[
                 {
                     'type': 'message',
                     'timestamp': 1458857193.973275,
                     'data': 'must be a mapping'
                 }
             ]
         )
     )
     assert len(result.values) == 1
     assert not result.values[0].get('data')
Esempio n. 6
0
 def test_simple(self):
     result = Breadcrumbs.to_python(dict(values=[{
         'type': 'message',
         'timestamp': 1458857193.973275,
         'data': {
             'message': 'Whats up dawg?',
         },
     }]))
     assert len(result.values) == 1
     assert result.values[0]['type'] == 'message'
     ts = result.values[0]['timestamp']
     assert int(ts) == 1458857193
     assert abs(ts - 1458857193.973275) < 0.001
     assert result.values[0]['data'] == {'message': 'Whats up dawg?'}
Esempio n. 7
0
    def test_null_values(self):
        sink = {}

        assert Breadcrumbs.to_python({}).to_json() == sink
        assert Breadcrumbs.to_python({'values': None}).to_json() == sink
        assert Breadcrumbs.to_python({'values': []}).to_json() == sink

        # TODO(markus): The following cases should eventually generate {"values": [None]}
        assert Breadcrumbs.to_python({'values': [{}]}).to_json() == sink
        assert Breadcrumbs.to_python({'values': [{"type": None}]}).to_json() == sink

        assert Breadcrumbs.to_python({'values': [None]}).to_json() == sink
Esempio n. 8
0
    def test_null_values(self):
        sink = {}

        assert Breadcrumbs.to_python({}).to_json() == sink
        assert Breadcrumbs.to_python({'values': None}).to_json() == sink
        assert Breadcrumbs.to_python({'values': []}).to_json() == sink

        # TODO(markus): The following cases should eventually generate {"values": [None]}
        assert Breadcrumbs.to_python({'values': [{}]}).to_json() == sink
        assert Breadcrumbs.to_python({
            'values': [{
                "type": None
            }]
        }).to_json() == sink

        assert Breadcrumbs.to_python({'values': [None]}).to_json() == sink
Esempio n. 9
0
 def test_path(self):
     assert Breadcrumbs().get_path() == 'breadcrumbs'
Esempio n. 10
0
 def test_path(self):
     assert Breadcrumbs().get_path() == 'sentry.interfaces.Breadcrumbs'