Exemple #1
0
        public async Task RunnersCanBeUpdated()
        {
            var request = new CreateRunnerRequest()
            {
                Token       = GitLabContainerFixture.RunnerRegistrationToken,
                Description = "RunnersCanBeUpdated",
                Active      = false
            };

            var runnerToken = await _sut.CreateAsync(request);

            runnerToken.Should().NotBeNull();

            var updateRequest = new UpdateRunnerRequest()
            {
                Description = request.Description + "Updated",
                TagList     = new List <string>()
                {
                    "updated_tags"
                },
                Active = true
            };
            await _sut.UpdateAsync(runnerToken.Id, updateRequest);

            var runner = await _sut.GetAsync(runnerToken.Id);

            runner.Should().NotBeNull();

            runner.Should().Match <RunnerDetails>(r =>
                                                  r.Description == updateRequest.Description &&
                                                  r.Active == updateRequest.Active
                                                  );
            runner.TagList.Should().BeEquivalentTo(updateRequest.TagList);
        }
Exemple #2
0
        public async Task RunnersCanBeDeletedById()
        {
            var request = new CreateRunnerRequest()
            {
                Token       = GitLabContainerFixture.RunnerRegistrationToken,
                Description = "RunnersCanBeDeleted"
            };

            var runnerToken = await _sut.CreateAsync(request);

            runnerToken.Should().NotBeNull();

            await _sut.DeleteAsync(runnerToken.Id);

            try
            {
                var runner = await _sut.GetAsync(runnerToken.Id);

                runner.Should().BeNull();
            }
            catch (GitLabException e)
            {
                e.HttpStatusCode.Should().Be(404);
            }
        }
Exemple #3
0
        public async Task RunnerCanCheckAuthentication()
        {
            var request = new CreateRunnerRequest()
            {
                Token       = GitLabContainerFixture.RunnerRegistrationToken,
                Description = "RunnerCanCheckAuthentication"
            };

            var runnerToken = await _sut.CreateAsync(request);

            runnerToken.Should().NotBeNull();

            bool result = await _sut.VerifyAuthenticationAsync(runnerToken.Token);

            result.Should().BeTrue();

            result = await _sut.VerifyAuthenticationAsync(runnerToken.Token + "fail");

            result.Should().BeFalse();
        }
Exemple #4
0
        public async Task RunnersCanBeCreatedAndRetrievedById()
        {
            var request = new CreateRunnerRequest()
            {
                Token       = GitLabContainerFixture.RunnerRegistrationToken,
                Description = "RunnerCanBeCreated",
                Active      = false,
                TagList     = new List <string> {
                    "tag1", "tag2"
                }
            };

            var runnerToken = await _sut.CreateAsync(request);

            runnerToken.Should().NotBeNull();

            var runner = await _sut.GetAsync(runnerToken.Id);

            runner.Should().Match <RunnerDetails>(r =>
                                                  r.Description == request.Description &&
                                                  r.Active == request.Active
                                                  );
            runner.TagList.Should().BeEquivalentTo(request.TagList);
        }