Example #1
0
 def test_sign_and_move_file_error(self, remove_signed_file_mock,
                                   private_storage_mock, sign_app_mock):
     extension = Extension(uuid='12345678123456781234567812345678')
     version = ExtensionVersion(extension=extension, pk=123)
     sign_app_mock.side_effect = SigningError
     with self.assertRaises(SigningError):
         version.sign_and_move_file()
     eq_(remove_signed_file_mock.call_count, 1)
Example #2
0
 def test_sign_and_move_file(self, remove_signed_file_mock,
                             private_storage_mock, sign_app_mock):
     extension = Extension(uuid='ab345678123456781234567812345678')
     version = ExtensionVersion(extension=extension, pk=123)
     version.sign_and_move_file()
     expected_args = (
         private_storage_mock.open.return_value,
         version.signed_file_path,
         json.dumps({
             'id': 'ab345678123456781234567812345678',
             'version': 123,
         })
     )
     eq_(sign_app_mock.call_args[0], expected_args)
     eq_(remove_signed_file_mock.call_count, 0)
Example #3
0
 def test_sign_and_move_file_no_version_pk(self, private_storage_mock,
                                           sign_app_mock):
     extension = Extension(uuid='12345678123456781234567812345678')
     version = ExtensionVersion(extension=extension)
     with self.assertRaises(SigningError):
         version.sign_and_move_file()