blockchain-certificates/cert-issuer

Intermittently failing test

Opened this issue · 0 comments

This test seems to be failing sometimes in travis, been happening for the last couple of months:

474=================================== FAILURES ===================================
475____________________ TestCertificateHandler.test_add_proof _____________________
476
477self = <tests.test_certificate_handler.TestCertificateHandler testMethod=test_add_proof>
478mock_open = <MagicMock name='open' id='139936690795744'>
479
480    @mock.patch("builtins.open", create=True)
481    def test_add_proof(self,mock_open):
482        handler = CertificateV2Handler()
483    
484        cert_to_issue = {'kek':'kek'}
485        proof = {'a': 'merkel'}
486        file_call = 'call().__enter__().write(\'{"kek": "kek", "signature": {"a": "merkel"}}\')'
487    
488        chain = mock.Mock()
489        metadata = mock.Mock()
490        metadata.blockchain_cert_file_name = 'file_path.nfo'
491    
492        with patch.object(
493        CertificateV2Handler, '_get_certificate_to_issue', return_value=cert_to_issue) as mock_method:
494                handler.add_proof(metadata, proof)
495    
496        mock_open.assert_any_call('file_path.nfo','w')
497        calls = mock_open.mock_calls
498        call_strings = map(str, calls)
499>       assert file_call in call_strings
500E       AssertionError: assert 'call().__enter__().write(\'{"kek": "kek", "signature": {"a": "merkel"}}\')' in <map object at 0x7f458cb96c18>
501
502test_certificate_handler.py:216: AssertionError