Example #1
0
        public async Task ShouldUpdateWorkflowAction()
        {
            WebhookWorkflowActionRequest workflowActionRequest = new WebhookWorkflowActionRequest();

            _apiClient.Setup(apiClient =>
                             apiClient.Put <EmptyResponse>("workflows" + "/workflow_id/actions/action_id", _authorization,
                                                           workflowActionRequest, CancellationToken.None, null))
            .ReturnsAsync(() => new EmptyResponse());

            IWorkflowsClient workflowsClient = new WorkflowsClient(_apiClient.Object, _configuration.Object);

            var getResponse =
                await workflowsClient.UpdateWorkflowAction("workflow_id", "action_id", workflowActionRequest);

            getResponse.ShouldNotBeNull();
        }
Example #2
0
        public async Task ShouldUpdateWorkflowAction()
        {
            var createdWorkflow = await CreateWorkflow();

            createdWorkflow.ShouldNotBeNull();
            createdWorkflow.Id.ShouldNotBeNull();

            GetWorkflowResponse getWorkflowResponse = await DefaultApi.WorkflowsClient().GetWorkflow(createdWorkflow.Id);

            getWorkflowResponse.ShouldNotBeNull();
            getWorkflowResponse.Id.ShouldNotBeNullOrEmpty();
            getWorkflowResponse.Name.ShouldBe(WorkflowName);
            getWorkflowResponse.Actions.ShouldNotBeNull();
            getWorkflowResponse.Actions.Count.ShouldBe(1);
            string actionId = getWorkflowResponse.Actions[0].Id;

            WebhookWorkflowActionRequest updateAction =
                new WebhookWorkflowActionRequest
            {
                Url       = "https://google.com/fail/fake",
                Headers   = new Dictionary <string, string>(),
                Signature = new WebhookSignature {
                    Key = "8V8x0dLK%AyD*DNS8JJr", Method = "HMACSHA256"
                }
            };

            var emptyResponse = await DefaultApi.WorkflowsClient().UpdateWorkflowAction(getWorkflowResponse.Id, actionId, updateAction);

            emptyResponse.ShouldNotBeNull();
            emptyResponse.HttpStatusCode.ShouldNotBeNull();
            emptyResponse.ResponseHeaders.ShouldNotBeNull();

            GetWorkflowResponse getWorkflowResponseUpdated =
                await DefaultApi.WorkflowsClient().GetWorkflow(createdWorkflow.Id);

            getWorkflowResponseUpdated.Actions.ShouldNotBeNull();
            getWorkflowResponseUpdated.Actions.Count.ShouldBe(1);

            WorkflowActionResponse action = getWorkflowResponseUpdated.Actions[0];

            action.Id.ShouldNotBeNullOrEmpty();
            action.Type.ShouldNotBeNull();
        }