Commit aedb3d92 authored by Lucas Carvalho's avatar Lucas Carvalho

Moved the creation of signature files to setUp method.

Now the mixin class is able to create the files which are required to
add the signature, it will be usefull for TestNetworkcacheClient.
parent 1c08c506
...@@ -33,6 +33,8 @@ class LibNetworkCacheMixin(unittest.TestCase): ...@@ -33,6 +33,8 @@ class LibNetworkCacheMixin(unittest.TestCase):
'--organization-unit-name', 'Dev', '--organization-unit-name', 'Dev',
'--common-name', 'R500.com', '--common-name', 'R500.com',
'--email', 'test@example.com') '--email', 'test@example.com')
self.option_dict = parseArgument(*self.signature_creation_argument_list)
self.cert_as_text = createPrivateKeyAndCertificateFile(**self.option_dict)
def tearDown(self): def tearDown(self):
''' Remove the files which have been created during the test. ''' ''' Remove the files which have been created during the test. '''
...@@ -63,14 +65,13 @@ class GenerateSignatureScriptTest(LibNetworkCacheMixin): ...@@ -63,14 +65,13 @@ class GenerateSignatureScriptTest(LibNetworkCacheMixin):
''' '''
Check if the argument is properly set. Check if the argument is properly set.
''' '''
option_dict = parseArgument(*self.signature_creation_argument_list)
size_argument_list = len(self.signature_creation_argument_list)/2 size_argument_list = len(self.signature_creation_argument_list)/2
size_option_dict = len(option_dict) size_option_dict = len(self.option_dict)
self.assertEquals(size_argument_list, size_option_dict, self.assertEquals(size_argument_list, size_option_dict,
"Argument list should have the same size of option dict.") "Argument list should have the same size of option dict.")
# Assert if the values are equals. # Assert if the values are equals.
for value in option_dict.values(): for value in self.option_dict.values():
self.assertTrue(value in self.signature_creation_argument_list,\ self.assertTrue(value in self.signature_creation_argument_list,\
'%s is not in %s.' % (value, self.signature_creation_argument_list)) '%s is not in %s.' % (value, self.signature_creation_argument_list))
...@@ -78,8 +79,5 @@ class GenerateSignatureScriptTest(LibNetworkCacheMixin): ...@@ -78,8 +79,5 @@ class GenerateSignatureScriptTest(LibNetworkCacheMixin):
''' '''
Check if key file and the certificate file are being created correctly. Check if key file and the certificate file are being created correctly.
''' '''
option_dict = parseArgument(*self.signature_creation_argument_list)
cert_as_text = createPrivateKeyAndCertificateFile(**option_dict)
self.assertTrue(os.path.exists(self.signature_certificate_file)) self.assertTrue(os.path.exists(self.signature_certificate_file))
self.assertTrue(os.path.exists(self.signature_private_key_file)) self.assertTrue(os.path.exists(self.signature_private_key_file))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment