@@ -194,7 +194,7 @@ class TestCommon(unittest.TestCase):
194
194
"""Test common functions of the securesystemslib._gpg module."""
195
195
196
196
@classmethod
197
- def setUpClass (self ):
197
+ def setUpClass (cls ):
198
198
gpg_keyring_path = os .path .join (
199
199
os .path .dirname (os .path .realpath (__file__ )), "gpg_keyrings" , "rsa"
200
200
)
@@ -208,9 +208,9 @@ def setUpClass(self):
208
208
with open (path , "rb" ) as f :
209
209
data [keyid ] = f .read ()
210
210
211
- self .raw_key_data = data [key ]
212
- self .raw_key_bundle = parse_pubkey_bundle (data [key ])
213
- self .raw_expired_key_bundle = parse_pubkey_bundle (data [key_expired ])
211
+ cls .raw_key_data = data [key ]
212
+ cls .raw_key_bundle = parse_pubkey_bundle (data [key ])
213
+ cls .raw_expired_key_bundle = parse_pubkey_bundle (data [key_expired ])
214
214
215
215
def test_parse_pubkey_payload_errors (self ):
216
216
"""Test parse_pubkey_payload errors with manually crafted data."""
@@ -541,25 +541,25 @@ class TestGPGRSA(unittest.TestCase):
541
541
keyid_768C43 = "7B3ABB26B97B655AB9296BD15B0BD02E1C768C43" # noqa: N815
542
542
543
543
@classmethod
544
- def setUpClass (self ):
544
+ def setUpClass (cls ):
545
545
# Create directory to run the tests without having everything blow up
546
- self .working_dir = os .getcwd ()
546
+ cls .working_dir = os .getcwd ()
547
547
548
548
# Find demo files
549
549
gpg_keyring_path = os .path .join (
550
550
os .path .dirname (os .path .realpath (__file__ )), "gpg_keyrings" , "rsa"
551
551
)
552
552
553
- self .test_dir = os .path .realpath (tempfile .mkdtemp ())
554
- self .gnupg_home = "rsa"
555
- shutil .copytree (gpg_keyring_path , os .path .join (self .test_dir , self .gnupg_home ))
556
- os .chdir (self .test_dir )
553
+ cls .test_dir = os .path .realpath (tempfile .mkdtemp ())
554
+ cls .gnupg_home = "rsa"
555
+ shutil .copytree (gpg_keyring_path , os .path .join (cls .test_dir , cls .gnupg_home ))
556
+ os .chdir (cls .test_dir )
557
557
558
558
@classmethod
559
- def tearDownClass (self ):
559
+ def tearDownClass (cls ):
560
560
"""Change back to initial working dir and remove temp test directory."""
561
- os .chdir (self .working_dir )
562
- shutil .rmtree (self .test_dir , onerror = GPGTestUtils .ignore_not_found_error )
561
+ os .chdir (cls .working_dir )
562
+ shutil .rmtree (cls .test_dir , onerror = GPGTestUtils .ignore_not_found_error )
563
563
564
564
def test_export_pubkey_error (self ):
565
565
"""Test correct error is raised if function called incorrectly."""
@@ -705,25 +705,25 @@ class TestGPGDSA(unittest.TestCase):
705
705
default_keyid = "C242A830DAAF1C2BEF604A9EF033A3A3E267B3B1"
706
706
707
707
@classmethod
708
- def setUpClass (self ):
708
+ def setUpClass (cls ):
709
709
# Create directory to run the tests without having everything blow up
710
- self .working_dir = os .getcwd ()
711
- self .test_dir = os .path .realpath (tempfile .mkdtemp ())
712
- self .gnupg_home = "dsa"
710
+ cls .working_dir = os .getcwd ()
711
+ cls .test_dir = os .path .realpath (tempfile .mkdtemp ())
712
+ cls .gnupg_home = "dsa"
713
713
714
714
# Find keyrings
715
715
keyrings = os .path .join (
716
716
os .path .dirname (os .path .realpath (__file__ )), "gpg_keyrings" , "dsa"
717
717
)
718
718
719
- shutil .copytree (keyrings , os .path .join (self .test_dir , self .gnupg_home ))
720
- os .chdir (self .test_dir )
719
+ shutil .copytree (keyrings , os .path .join (cls .test_dir , cls .gnupg_home ))
720
+ os .chdir (cls .test_dir )
721
721
722
722
@classmethod
723
- def tearDownClass (self ):
723
+ def tearDownClass (cls ):
724
724
"""Change back to initial working dir and remove temp test directory."""
725
- os .chdir (self .working_dir )
726
- shutil .rmtree (self .test_dir , onerror = GPGTestUtils .ignore_not_found_error )
725
+ os .chdir (cls .working_dir )
726
+ shutil .rmtree (cls .test_dir , onerror = GPGTestUtils .ignore_not_found_error )
727
727
728
728
def test_export_pubkey (self ):
729
729
"""export a public key and make sure the parameters are the right ones:
@@ -796,25 +796,25 @@ class TestGPGEdDSA(unittest.TestCase):
796
796
default_keyid = "4E630F84838BF6F7447B830B22692F5FEA9E2DD2"
797
797
798
798
@classmethod
799
- def setUpClass (self ):
799
+ def setUpClass (cls ):
800
800
# Create directory to run the tests without having everything blow up
801
- self .working_dir = os .getcwd ()
802
- self .test_dir = os .path .realpath (tempfile .mkdtemp ())
803
- self .gnupg_home = "dsa"
801
+ cls .working_dir = os .getcwd ()
802
+ cls .test_dir = os .path .realpath (tempfile .mkdtemp ())
803
+ cls .gnupg_home = "dsa"
804
804
805
805
# Find keyrings
806
806
keyrings = os .path .join (
807
807
os .path .dirname (os .path .realpath (__file__ )), "gpg_keyrings" , "eddsa"
808
808
)
809
809
810
- shutil .copytree (keyrings , os .path .join (self .test_dir , self .gnupg_home ))
811
- os .chdir (self .test_dir )
810
+ shutil .copytree (keyrings , os .path .join (cls .test_dir , cls .gnupg_home ))
811
+ os .chdir (cls .test_dir )
812
812
813
813
@classmethod
814
- def tearDownClass (self ):
814
+ def tearDownClass (cls ):
815
815
"""Change back to initial working dir and remove temp test directory."""
816
- os .chdir (self .working_dir )
817
- shutil .rmtree (self .test_dir , onerror = GPGTestUtils .ignore_not_found_error )
816
+ os .chdir (cls .working_dir )
817
+ shutil .rmtree (cls .test_dir , onerror = GPGTestUtils .ignore_not_found_error )
818
818
819
819
def test_gpg_sign_and_verify_object_with_default_key (self ):
820
820
"""Create a signature using the default key on the keyring"""
0 commit comments