def test_bad_convert_to_api_without_ssh_key(self):

        with self.assertRaises(StandardError):
            user = '******'
            password = '******'
            role_user = CreateRoleAccount(self.users_filename,
                                          self.ssl_auth_filename,
                                          account_name=user,
                                          account_password=password)
            role_user.convert_to_api()
 def test_failed_users_sls(self):
     """
     Testing a failed import_users_sls() function
     """
     user = '******'
     password = '******'
     role_user = CreateRoleAccount(self.bad_users_filename,
                                   self.bad_ssl_auth_filename,
                                   account_name=user,
                                   account_password=password)
     with self.assertRaises(yaml.scanner.ScannerError):
         role_user.import_users_sls()
 def test_import_ssh_sls(self):
     """
     Testing the import_ssh_sls function
     """
     user = '******'
     password = '******'
     role_user = CreateRoleAccount(self.users_filename,
                                   self.ssl_auth_filename,
                                   account_name=user,
                                   account_password=password)
     expected = dict
     role_user.import_ssh_sls()
     actual = type(role_user.ssh)
     self.assertEqual(
         expected, actual,
         "Expected type {}. but got {},".format(expected, actual))
 def test_convert_to_api_without_email(self):
     user = '******'
     password = '******'
     expected = {
         'username':
         '******',
         'email':
         '*****@*****.**',
         'name':
         'r-infraops-git',
         'password':
         '******',
         'ssh-key':
         'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCJlrG43+2eJDNi3pkIph8PHCqJAoTRq1sRVZZ9tW0AXSXROOcxB1wLHFIx9iiBKNKqrxSRmFyKaWtvMjSqxL7e62Ll+QfjQGt8UyyiTVfWFx+aGy8YUil3OPej7UayOS3Izk6zwDUvRAjP41kIdZEP8oRTvRbUdo3j8sLIaSkF/yiYtqehSl2yZasQAOubLBbk4hq5sgLfmdyScb6J+zRn5SEwMHNufTbPQXArAeZa+zVA4y/zrCecPRIKfWCi6JadaZRS7DPa2Eyj1ShLVDqD7vIT4EyhAIkPFXam+MK641DyoNj9HSHv5FaAt6fSvQaH9PR/MCSSSdwgb6YT/Jx [email protected]'
     }
     role_user = CreateRoleAccount(self.users_filename,
                                   self.ssl_auth_filename,
                                   account_name=user,
                                   account_password=password)
     role_user.convert_to_api()
     actual = role_user.new_user
     self.assertEqual(expected, actual,
                      "Expected {}, but got {}".format(expected, actual))