//_token public async Task Member() { var task = await _tasksApi.CreateTaskCron(GenerateName("it task"), TaskFlux, "0 2 * * *", _organization); var members = await _tasksApi.GetMembers(task); Assert.AreEqual(0, members.Count); var user = await _usersApi.CreateUser(GenerateName("Luke Health")); var resourceMember = await _tasksApi.AddMember(user, task); Assert.IsNotNull(resourceMember); Assert.AreEqual(resourceMember.Id, user.Id); Assert.AreEqual(resourceMember.Name, user.Name); Assert.AreEqual(resourceMember.Role, ResourceMember.RoleEnum.Member); members = await _tasksApi.GetMembers(task); Assert.AreEqual(1, members.Count); Assert.AreEqual(members[0].Id, user.Id); Assert.AreEqual(members[0].Name, user.Name); Assert.AreEqual(members[0].Role, ResourceMember.RoleEnum.Member); await _tasksApi.DeleteMember(user, task); members = await _tasksApi.GetMembers(task); Assert.AreEqual(0, members.Count); }
public async Task Member() { var bucket = await _bucketsApi.CreateBucket(GenerateName("robot sensor"), RetentionRule(), _organization); var members = await _bucketsApi.GetMembers(bucket); Assert.AreEqual(0, members.Count); var user = await _usersApi.CreateUser(GenerateName("Luke Health")); var resourceMember = await _bucketsApi.AddMember(user, bucket); Assert.IsNotNull(resourceMember); Assert.AreEqual(resourceMember.Id, user.Id); Assert.AreEqual(resourceMember.Name, user.Name); Assert.AreEqual(resourceMember.Role, ResourceMember.RoleEnum.Member); members = await _bucketsApi.GetMembers(bucket); Assert.AreEqual(1, members.Count); Assert.AreEqual(members[0].Id, user.Id); Assert.AreEqual(members[0].Name, user.Name); Assert.AreEqual(members[0].Role, ResourceMember.RoleEnum.Member); await _bucketsApi.DeleteMember(user, bucket); members = await _bucketsApi.GetMembers(bucket); Assert.AreEqual(0, members.Count); }
public async Task Member() { var scraper = await _scraperTargetsApi .CreateScraperTarget(GenerateName("InfluxDB scraper"), "http://localhost:9999", _bucket.Id, _organization.Id); var members = await _scraperTargetsApi.GetMembers(scraper); Assert.AreEqual(0, members.Count); var user = await _usersApi.CreateUser(GenerateName("Luke Health")); var resourceMember = await _scraperTargetsApi.AddMember(user, scraper); Assert.IsNotNull(resourceMember); Assert.AreEqual(resourceMember.Id, user.Id); Assert.AreEqual(resourceMember.Name, user.Name); Assert.AreEqual(resourceMember.Role, ResourceMember.RoleEnum.Member); members = await _scraperTargetsApi.GetMembers(scraper); Assert.AreEqual(1, members.Count); Assert.AreEqual(members[0].Id, user.Id); Assert.AreEqual(members[0].Name, user.Name); Assert.AreEqual(members[0].Role, ResourceMember.RoleEnum.Member); await _scraperTargetsApi.DeleteMember(user, scraper); members = await _scraperTargetsApi.GetMembers(scraper); Assert.AreEqual(0, members.Count); }
public async Task Member() { var telegrafConfig = await _telegrafsApi .CreateTelegraf(GenerateName("tc"), "test-config", _organization, 1_000, new List <TelegrafRequestPlugin> { NewCpuPlugin(), NewOutputPlugin() }); var members = await _telegrafsApi.GetMembers(telegrafConfig); Assert.AreEqual(0, members.Count); var user = await _usersApi.CreateUser(GenerateName("Luke Health")); var resourceMember = await _telegrafsApi.AddMember(user, telegrafConfig); Assert.IsNotNull(resourceMember); Assert.AreEqual(resourceMember.Id, user.Id); Assert.AreEqual(resourceMember.Name, user.Name); Assert.AreEqual(resourceMember.Role, ResourceMember.RoleEnum.Member); members = await _telegrafsApi.GetMembers(telegrafConfig); Assert.AreEqual(1, members.Count); Assert.AreEqual(members[0].Id, user.Id); Assert.AreEqual(members[0].Name, user.Name); Assert.AreEqual(members[0].Role, ResourceMember.RoleEnum.Member); await _telegrafsApi.DeleteMember(user, telegrafConfig); members = await _telegrafsApi.GetMembers(telegrafConfig); Assert.AreEqual(0, members.Count); }
public async Task Member() { var organization = await _organizationsApi.CreateOrganization(GenerateName("Constant Pro")); var members = await _organizationsApi.GetMembers(organization); Assert.AreEqual(0, members.Count); var user = await _usersApi.CreateUser(GenerateName("Luke Health")); var resourceMember = await _organizationsApi.AddMember(user, organization); Assert.IsNotNull(resourceMember); Assert.AreEqual(resourceMember.Id, user.Id); Assert.AreEqual(resourceMember.Name, user.Name); Assert.AreEqual(resourceMember.Role, ResourceMember.RoleEnum.Member); members = await _organizationsApi.GetMembers(organization); Assert.AreEqual(1, members.Count); Assert.AreEqual(members[0].Id, user.Id); Assert.AreEqual(members[0].Name, user.Name); Assert.AreEqual(members[0].Role, ResourceMember.RoleEnum.Member); await _organizationsApi.DeleteMember(user, organization); members = await _organizationsApi.GetMembers(organization); Assert.AreEqual(0, members.Count); }
public User CreateUser(string userId) { var token = GetClientToken(); var user = new UserCreateParams(); user.Id = userId; var userApi = new UsersApi(BasePath); userApi.ApiClient.AddDefaultHeader("Authorization", "Bearer " + token); var result = userApi.CreateUser(user); return(result); }
public async Task CreateUser() { var userName = GenerateName("John Ryzen"); var user = await _usersApi.CreateUser(userName); Assert.IsNotNull(user); Assert.IsNotEmpty(user.Id); Assert.AreEqual(user.Name, userName); var links = user.Links; Assert.IsNotNull(links); Assert.AreEqual(links.Self, $"/api/v2/users/{user.Id}"); Assert.AreEqual(links.Logs, $"/api/v2/users/{user.Id}/logs"); }
public BaseResponse CreateUser(CreateUserViewModel createUser) { var user = UsersApi.CreateUser(createUser); try { return(new BaseResponse() { Data = user, StatusCode = (int)HttpStatusCode.OK }); } catch (Exception e) { return(new BaseResponse() { Message = e.Message, StatusCode = (int)HttpStatusCode.InternalServerError }); } }
public IActionResult SignUp(string name, string password) { if (!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(password)) { int?userId = getSessionUserId(); if (!userId.HasValue) { int?createdUserId = usersApi.CreateUser(name, password); if (createdUserId.HasValue) { return(RedirectToAction("LogIn", "Auth", new { userId = createdUserId.Value, userPassword = password })); } else { ViewData["Message"] = "user creation has been failed"; } } } putSessionToViewData(); return(View()); }