def test_stacktrace_wins_over_http(http_comp_hash, stack_comp_hash): # this was a regression, and a very important one http_comp_hash.return_value = [['baz']] stack_comp_hash.return_value = [['foo', 'bar']] event = Event( data={ 'stacktrace': { 'frames': [{ 'lineno': 1, 'filename': 'foo.py', }], }, 'request': { 'url': 'http://example.com' }, }, platform='python', message='Foo bar', ) hashes = event.get_hashes() assert len(hashes) == 1 hash_one = hashes[0] stack_comp_hash.assert_called_once_with('python') assert not http_comp_hash.called assert hash_one == md5_from_hash(['foo', 'bar'])
def test_checksum_rehashed(self): checksum = 'invalid checksum hash' manager = EventManager(make_event(**{ 'checksum': checksum, })) manager.normalize() event = manager.save(self.project.id) hashes = [ gh.hash for gh in GroupHash.objects.filter(group=event.group) ] assert hashes == [md5_from_hash(checksum), checksum]
def test_checksum_rehashed(self): checksum = 'invalid checksum hash' manager = EventManager( make_event(**{ 'checksum': checksum, }) ) manager.normalize() event = manager.save(self.project.id) hashes = [gh.hash for gh in GroupHash.objects.filter(group=event.group)] assert hashes == [md5_from_hash(checksum), checksum]
def test_md5_from_hash(): result = md5_from_hash(['foo', 'bar', u'foô']) assert result == '6d81588029ed4190110b2779ba952a00'