public async Task Login_Succeeds_SslverifyFalse() { //needs a localhost socks proxy (like fiddler) HttpClient httpClient = GetHttpClient(configWithInvalidSsl.BaseUrl, null, false); var uc = new UnifiControllerClient(httpClient); await uc.Login(config.UserName, config.Password); }
public async Task GetSysInfo() { HttpClient httpClient = GetHttpClient(config.BaseUrl); var uc = new UnifiControllerClient(httpClient); await uc.Login(config.UserName, config.Password); var actual = await uc.GetSysInfo(); Assert.NotNull(actual); }
private static async Task <Sta[]> GetConnectedClients(ControllerConfig controllerConfig, PresenceRecordingSettings presenceConfig, ILogger logger) { var controllerClient = new UnifiControllerClient(GetHttpClient(controllerConfig.BaseUrl, presenceConfig.SOCKS, presenceConfig.VerifySsl)); var loginResult = await controllerClient.Login(controllerConfig.UserName, controllerConfig.Password); if (loginResult == true) { var sites = await controllerClient.GetSites(); string siteName = null; if (string.IsNullOrEmpty(controllerConfig.ControllerSiteDescription) || controllerConfig.ControllerSiteDescription?.ToLower() == "default") { siteName = sites.FirstOrDefault(p => string.Compare("default", p.Name, StringComparison.InvariantCultureIgnoreCase) == 0)?.Name; } else { siteName = sites.FirstOrDefault(p => string.Compare(controllerConfig.ControllerSiteDescription, p.Desc, StringComparison.InvariantCultureIgnoreCase) == 0)?.Name; } if (siteName == null) { logger.LogError($"The controller site description {controllerConfig.ControllerSiteDescription} could not be found."); } else { var connectedDevices = await controllerClient.GetConnectedClients(siteName); return(connectedDevices); } } else { logger.LogError("Failed to log on to the controller."); } return(null); }
public async Task Login_Succeeds_Ubnt_demo() { HttpClient httpClient = GetHttpClient("https://demo.ubnt.com/"); var uc = new UnifiControllerClient(httpClient); await uc.Login("demo", "demo"); }
public async Task Login_Succeeds_nginx() { HttpClient httpClient = GetHttpClient(config.BaseUrl); var uc = new UnifiControllerClient(httpClient); await uc.Login(config.UserName, config.Password); }