def test_sanitize_connection_string(self): """ Test a valid invocation of API sanitize_connection_string """ result = EdgeUtils.sanitize_connection_string( 'HostName=aa;DeviceId=bb;SharedAccessKey=cc') pattern = re.compile( r'^HostName=aa;DeviceId=bb;SharedAccessKey=[\*]+$') self.assertTrue(pattern.match(result)) result = EdgeUtils.sanitize_connection_string( 'HostName=aa;DeviceId=bb;sharedaccesskey=cc') pattern = re.compile( r'^HostName=aa;DeviceId=bb;sharedaccesskey=[\*]+$') self.assertTrue(pattern.match(result)) result = EdgeUtils.sanitize_connection_string( 'HostName=aaa;DeviceId=bbb') pattern = re.compile(r'^HostName=aaa;DeviceId=bbb+$') self.assertTrue(pattern.match(result))
def __str__(self): result = 'Schema Version:\t\t' + self.schema_version + '\n' conn_str = EdgeUtils.sanitize_connection_string(self.connection_string) result += 'Connection String:\t' + conn_str + '\n' result += 'Config Directory:\t' + self.config_dir + '\n' result += 'Home Directory:\t\t' + self.home_dir + '\n' result += 'Hostname:\t\t' + self.hostname + '\n' result += 'Log Level:\t\t' + self.log_level + '\n' if self.certificate_config: result += str(self.certificate_config) if self.deployment_config: result += str(self.deployment_config) return result