コード例 #1
0
ファイル: test_exception.py プロジェクト: duanshuaimin/sentry
 def test_only_requires_only_type_or_value(self):
     SingleException.to_python(dict(
         type='ValueError',
     ))
     SingleException.to_python(dict(
         value='ValueError',
     ))
コード例 #2
0
 def test_only_requires_only_type_or_value(self):
     SingleException.to_python(dict(
         type='ValueError',
     ))
     SingleException.to_python(dict(
         value='ValueError',
     ))
コード例 #3
0
    def test_handles_type_in_value(self):
        result = SingleException.to_python(dict(value="ValueError: unauthorized"))
        assert result.type == "ValueError"
        assert result.value == "unauthorized"

        result = SingleException.to_python(dict(value="ValueError:unauthorized"))
        assert result.type == "ValueError"
        assert result.value == "unauthorized"
コード例 #4
0
    def test_handles_type_in_value(self):
        result = SingleException.to_python(
            dict(value='ValueError: unauthorized', ))
        assert result.type == 'ValueError'
        assert result.value == 'unauthorized'

        result = SingleException.to_python(
            dict(value='ValueError:unauthorized', ))
        assert result.type == 'ValueError'
        assert result.value == 'unauthorized'
コード例 #5
0
ファイル: test_exception.py プロジェクト: duanshuaimin/sentry
    def test_handles_type_in_value(self):
        result = SingleException.to_python(dict(
            value='ValueError: unauthorized',
        ))
        assert result.type == 'ValueError'
        assert result.value == 'unauthorized'

        result = SingleException.to_python(dict(
            value='ValueError:unauthorized',
        ))
        assert result.type == 'ValueError'
        assert result.value == 'unauthorized'
コード例 #6
0
ファイル: test_exception.py プロジェクト: hosmelq/sentry
    def test_value_serialization_idempotent(self):
        result = SingleException.to_python({
            'type': None,
            'value': {'unauthorized': True},
        }).to_json()

        assert result['type'] is None
        assert result['value'] == '{"unauthorized":true}'

        # Don't re-split a json-serialized value on the colon
        result = SingleException.to_python(result).to_json()
        assert result['type'] is None
        assert result['value'] == '{"unauthorized":true}'
コード例 #7
0
    def test_value_serialization_idempotent(self):
        result = SingleException.to_python({
            'type': None,
            'value': {'unauthorized': True},
        }).to_json()

        assert 'type' not in result
        assert result['value'] == '{"unauthorized":true}'

        # Don't re-split a json-serialized value on the colon
        result = SingleException.to_python(result).to_json()
        assert 'type' not in result
        assert result['value'] == '{"unauthorized":true}'
コード例 #8
0
ファイル: test_exception.py プロジェクト: duanshuaimin/sentry
 def test_throws_away_empty_stacktrace(self):
     result = SingleException.to_python(dict(
         type='ValueError',
         value='foo',
         stacktrace={'frames': []},
     ))
     assert not result.stacktrace
コード例 #9
0
 def interface(self):
     return SingleException.to_python(
         dict(
             type='ValueError',
             value='hello world',
             module='foo.bar',
         ))
コード例 #10
0
 def test_coerces_object_value_to_string(self):
     result = SingleException.to_python(
         dict(
             type='ValueError',
             value={'unauthorized': True},
         ))
     assert result.value == '{"unauthorized":true}'
コード例 #11
0
 def test_throws_away_empty_stacktrace(self):
     result = SingleException.to_python(dict(
         type='ValueError',
         value='foo',
         stacktrace={'frames': []},
     ))
     assert not result.stacktrace
コード例 #12
0
 def test_coerces_object_value_to_string(self):
     result = SingleException.to_python({
         'type': 'ValueError',
         'value': {
             'unauthorized': True
         },
     })
     assert result.value == '{"unauthorized":true}'
コード例 #13
0
ファイル: test_exception.py プロジェクト: alshopov/sentry
 def interface(self):
     return SingleException.to_python(
         dict(
             type='ValueError',
             value='hello world',
             module='foo.bar',
         )
     )
コード例 #14
0
ファイル: test_exception.py プロジェクト: Getsidecar/sentry
 def interface(self):
     return SingleException.to_python(dict(type="ValueError", value="hello world", module="foo.bar"))
コード例 #15
0
ファイル: test_exception.py プロジェクト: duanshuaimin/sentry
 def test_coerces_object_value_to_string(self):
     result = SingleException.to_python(dict(
         type='ValueError',
         value={'unauthorized': True},
     ))
     assert result.value == '{"unauthorized":true}'
コード例 #16
0
 def test_throws_away_empty_stacktrace(self):
     result = SingleException.to_python(dict(type="ValueError", value="foo", stacktrace={"frames": []}))
     assert not result.stacktrace
コード例 #17
0
ファイル: test_exception.py プロジェクト: hosmelq/sentry
 def test_coerces_object_value_to_string(self):
     result = SingleException.to_python({
         'type': 'ValueError',
         'value': {'unauthorized': True},
     })
     assert result.value == '{"unauthorized":true}'