def test_got_credentials_password_and_secret(self): junk_dconf = { 'cifspassword': '******', 'cifspassword_secret': 'secret123' } got_creds = cifutils.containsCredentials(junk_dconf, prefix="cifs") self.assertEquals(got_creds, False)
def test_got_credentials_everything_smbsr(self): good_dconf = { 'username': '******', 'password': '******', 'password_secret': 'secret123' } self.assertEquals(cifutils.containsCredentials(good_dconf), True)
def test_got_credentials_everything(self): good_dconf = { 'username': '******', 'cifspassword': '******', 'cifspassword_secret': 'secret123' } got_creds = cifutils.containsCredentials(good_dconf, prefix="cifs") self.assertEquals(got_creds, True)
def test_got_credentials_everything_and_padding_smbsr(self): good_dconf = { 'sahara': 'camel', 'username': '******', 'password': '******', 'password_secret': 'secret123', 'nile': 'crocodile' } self.assertEquals(cifutils.containsCredentials(good_dconf), True)
def test_got_credentials_everything_and_padding(self): good_dconf = { 'sahara': 'camel', 'username': '******', 'cifspassword': '******', 'cifspassword_secret': 'secret123', 'nile': 'crocodile' } got_creds = cifutils.containsCredentials(good_dconf, prefix="cifs") self.assertEquals(got_creds, True)
def getMountOptions(self, domain): """Creates option string based on parameters provided""" options = ['cache=loose', 'vers=3.0', 'actimeo=0'] if domain: options.append('domain=' + domain) if not cifutils.containsCredentials(self.dconf): # No login details provided. options.append('guest') return options
def appendCIFSMountOptions(self, mountcmd): """Append options to mount.cifs""" options = [] try: options.append(self.getCacheOptions()) if not cifutils.containsCredentials(self.dconf, prefix="cifs"): options.append('guest') options.append(self.getSMBVersion()) username, domain = (cifutils.splitDomainAndUsername( self.dconf['username'])) if domain: options.append('domain=' + domain) except: util.SMlog("Exception while attempting to append mount options") raise # Extend mountcmd appropriately if options: options = ",".join(str(x) for x in options if x) mountcmd.extend(["-o", options])
def test_got_credentials_user_and_password_smbsr(self): good_dconf = {'username': '******', 'password': '******'} self.assertEquals(cifutils.containsCredentials(good_dconf), True)
def test_got_credentials_user_and_password(self): good_dconf = {'username': '******', 'cifspassword': '******'} got_cred = cifutils.containsCredentials(good_dconf, prefix="cifs") self.assertEquals(got_cred, True)
def test_got_credentials_password_and_secret_smbsr(self): junk_dconf = { 'password': '******', 'password_secret': 'secret123' } self.assertEquals(cifutils.containsCredentials(junk_dconf), False)
def test_got_credentials_username_only_smbsr(self): junk_dconf = {'username': '******'} self.assertEquals(cifutils.containsCredentials(junk_dconf), False)
def test_got_credentials_empty_dconf_smbsr(self): junk_dconf = {} self.assertEquals(cifutils.containsCredentials(junk_dconf), False)