docstr: " Test makes sure that after encrypted save-restore the model has the same weights. 
docstr_tok: ["``","Test","makes","sure","that","after","encrypted","save-restore","the","model","has","the","same","weights","."]
code: def test_eff_save_restore_from_nemo_file_encrypted(self, asr_model):
      """ " Test makes sure that after encrypted save-restore the model has the same weights."""
  
      with tempfile.NamedTemporaryFile() as fp:
          filename = fp.name
  
          # Set key - use checkpoint encryption.
          NeMoCookbook.set_encryption_key("test_key")
  
          # Save model (with random artifact).
          with tempfile.NamedTemporaryFile() as artifact:
              asr_model.register_artifact(
                  config_path="abc", src=artifact.name
              )
              asr_model.save_to(save_path=filename)
  
          # Try to restore the encrypted archive (weights) without the encryption key.
          NeMoCookbook.set_encryption_key(None)
          with pytest.raises(PermissionError):
              # Restore the model.
              asr_model2 = EncDecCTCModel.restore_from(
                  restore_path=filename
              )
  
          # Restore the model.
          NeMoCookbook.set_encryption_key("test_key")
          asr_model3 = EncDecCTCModel.restore_from(
              restore_path=filename
          )
          # Reset encryption so it won't mess up with other save/restore.
          NeMoCookbook.set_encryption_key(None)
  
          assert asr_model.num_weights == asr_model3.num_weights
  
file_path: NeMo/tests/core/test_fileio.py
imports: import os
  import tempfile
  import numpy
  import pytest
  import torch
  from omegaconf import DictConfig, OmegaConf
  from nemo.collections.asr.models import EncDecCTCModel
label_desc: Use image node_id 3 for calling the TestFileIO obj's underlying member method code with example usage: obj.test_eff_save_restore_from_nemo_file_encrypted(asr_model) without return types