public async Task CreateTaskCron() { var taskName = GenerateName("it task"); var task = await _tasksApi.CreateTaskCron(taskName, TaskFlux, "0 2 * * *", _organization); Assert.IsNotNull(task); Assert.IsNotEmpty(task.Id); Assert.AreEqual(taskName, task.Name); Assert.AreEqual(_organization.Id, task.OrgID); Assert.AreEqual(TaskStatusType.Active, task.Status); Assert.AreEqual("0 2 * * *", task.Cron); Assert.IsNull(task.Every); Assert.IsTrue(task.Flux.EndsWith(TaskFlux, StringComparison.OrdinalIgnoreCase)); }
//_token public async Task FindTasksByOrganization() { var taskOrg = await Client.GetOrganizationsApi().CreateOrganization(GenerateName("Task user")); var authorization = await AddAuthorization(taskOrg); Client.Dispose(); Client = InfluxDBClientFactory.Create(InfluxDbUrl, authorization.Token.ToCharArray()); _tasksApi = Client.GetTasksApi(); var count = (await _tasksApi.FindTasksByOrganization(taskOrg)).Count; Assert.AreEqual(0, count); await _tasksApi.CreateTaskCron(GenerateName("it task"), TaskFlux, "0 2 * * *", taskOrg); var tasks = await _tasksApi.FindTasksByOrganization(taskOrg); Assert.AreEqual(1, tasks.Count); (await _tasksApi.FindTasks()).ForEach(async task => await _tasksApi.DeleteTask(task)); }