old_contents: from unittest import TestCase
  
  from tokenserver.crypto.pyworker import CryptoWorker
  from tokenserver.tests.mockworker import MockCryptoWorker
  from tokenserver.tests.support import (
      sign_data,
      PurePythonRunner
  )
  from browserid.tests.support import patched_key_fetching, get_public_cert
  
  
  class TestPythonCryptoWorker(TestCase):
  
      def setUp(self):
          self.worker = CryptoWorker()
          self.runner = PurePythonRunner(self.worker)
  
      def test_check_signature(self):
          hostname = 'browserid.org'
          data = 'NOBODY EXPECTS THE SPANISH INQUISITION!'
  
          with patched_key_fetching():
              sig = sign_data(hostname, data)
              result = self.runner.check_signature(hostname=hostname,
                      signed_data=data, signature=sig, algorithm="DS128")
          self.assertTrue(result)
  
      def test_the_crypto_tester(self):
          self.worker = MockCryptoWorker()
          self.runner = PurePythonRunner(self.worker)
  
          hostname = 'browserid.org'
          data = 'NOBODY EXPECTS THE SPANISH INQUISITION!'
  
          sig = sign_data(hostname, data)
          result = self.runner.check_signature(hostname=hostname,
                  signed_data=data, signature=sig, algorithm="DS128")
          self.assertTrue(result)
  
      def test_check_signature_with_key(self):
          hostname = 'browserid.org'
          data = 'NOBODY EXPECTS THE SPANISH INQUISITION!'
          return
          # Not implemented yet.
  
          sig = sign_data(hostname, data)
          cert = get_public_cert(hostname)
  
          result = self.runner.check_signature_with_cert(cert=cert,
                  signed_data=data, signature=sig, algorithm='RS256')
  
          self.assertTrue(result)
  
      def test_key_derivation(self):
          return
          # result = self.call_worker('derivate_key')
  
new_contents: from unittest import TestCase
  
  from tokenserver.crypto.pyworker import CryptoWorker
  from tokenserver.tests.mockworker import MockCryptoWorker
  from tokenserver.tests.support import (
      sign_data,
      PurePythonRunner
  )
  from browserid.tests.support import patched_key_fetching
  
  
  class TestPythonCryptoWorker(TestCase):
  
      def setUp(self):
          self.worker = CryptoWorker()
          self.runner = PurePythonRunner(self.worker)
  
      def test_check_signature(self):
          hostname = 'browserid.org'
          data = 'NOBODY EXPECTS THE SPANISH INQUISITION!'
  
          with patched_key_fetching():
              sig = sign_data(hostname, data)
              result = self.runner.check_signature(hostname=hostname,
                      signed_data=data, signature=sig, algorithm="DS128")
          self.assertTrue(result)
  
      def test_the_crypto_tester(self):
          self.worker = MockCryptoWorker()
          self.runner = PurePythonRunner(self.worker)
  
          hostname = 'browserid.org'
          data = 'NOBODY EXPECTS THE SPANISH INQUISITION!'
  
          sig = sign_data(hostname, data)
          result = self.runner.check_signature(hostname=hostname,
                  signed_data=data, signature=sig, algorithm="DS128")
          self.assertTrue(result)
  
      def test_check_signature_with_key(self):
          hostname = 'browserid.org'
          data = 'NOBODY EXPECTS THE SPANISH INQUISITION!'
          return
          # Not implemented yet.
  
          sig = sign_data(hostname, data)
          #cert = get_public_cert(hostname)
  
          result = self.runner.check_signature_with_cert(cert=cert,
                  signed_data=data, signature=sig, algorithm='RS256')
  
          self.assertTrue(result)
  
      def test_key_derivation(self):
          return
          # result = self.call_worker('derivate_key')
  
subject: fix imports