Skip to content

Commit

Permalink
#159 - Remove Required attribute from upsert models; rename workflow …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
robert.stebel authored and gormal committed Jun 2, 2022
1 parent a0cc70f commit 193c4b9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
5 changes: 4 additions & 1 deletion Kentico.Kontent.Management.Tests/CodeSamples/CmApiV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,10 @@ public async void PutWorkflow()
{
var client = _fileSystemFixture.CreateMockClientWithResponse("Workflow.json");

var response = await client.UpdateWorkflowAsync(Reference.ByCodename("my_workflow"), new WorkflowUpsertModel
var identifier = Reference.ByCodename("my_workflow");
// var identifier = Reference.ById(Guid.Parse("f4b3fc05-e988-4dae-9ac1-a94aba566474"));

var response = await client.UpdateWorkflowAsync(identifier, new WorkflowUpsertModel
{
Name = "My workflow",
Scopes = new List<WorkflowScopeUpsertModel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async void ListWorkflows_ListsAllWorkflows()
}

[Fact]
public async void CreateWorkflow_ReturnsCreatedWorkflow()
public async void CreateWorkflow_CreatesWorkflow()
{
var newWorkflow = new WorkflowUpsertModel
{
Expand Down Expand Up @@ -82,7 +82,7 @@ public async void CreateWorkflow_ReturnsCreatedWorkflow()
}

[Fact]
public async void UpdateWorkflow_ReturnsUpdatedWorkflow()
public async void UpdateWorkflow_UpdatesWorkflow()
{
var newWorkflow = new WorkflowUpsertModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class WorkflowArchivedStepUpsertModel
/// <summary>
/// Gets or sets the roles which can work with an item in this step.
/// </summary>
[JsonProperty("role_ids", Required = Required.Always)]
[JsonProperty("role_ids")]
public IReadOnlyCollection<Guid> RoleIds { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public class WorkflowPublishedStepUpsertModel
/// <summary>
/// Gets or sets the roles which can create new version from published variant.
/// </summary>
[JsonProperty("create_new_version_role_ids", Required = Required.Always)]
[JsonProperty("create_new_version_role_ids")]
public IReadOnlyCollection<Guid> RoleCreateNewVersionIds { get; set; }

/// <summary>
/// Gets or sets the roles which can unpublish the item's variant.
/// </summary>
[JsonProperty("unpublish_role_ids", Required = Required.Always)]
[JsonProperty("unpublish_role_ids")]
public IReadOnlyCollection<Guid> RolesUnpublishArchivedCancelSchedulingIds { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class WorkflowScopeUpsertModel
/// <summary>
/// Gets or sets the workflow scope's content types.
/// </summary>
[JsonProperty("content_types", Required = Required.Always)]
[JsonProperty("content_types")]
public IReadOnlyList<Reference> ContentTypes { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class WorkflowStepTransitionToUpsertModel
/// <summary>
/// Gets or sets the workflow step's internal ID.
/// </summary>
[JsonProperty("step", Required = Required.Always)]
[JsonProperty("step")]
public Reference Step { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ public class WorkflowStepUpsertModel
/// Not applicable for creating a new workflow because the property is used
/// to identify already existing steps within the edited workflow
/// </remarks>
[JsonProperty("id", Required = Required.Default)]
[JsonProperty("id")]
public Guid? Id { get; set; }

/// <summary>
/// Gets or sets the workflow step's name.
/// </summary>
[JsonProperty("name", Required = Required.Always)]
[JsonProperty("name")]
public string Name { get; set; }

/// <summary>
/// Gets or sets the workflow step's codename.
/// </summary>
[JsonProperty("codename", Required = Required.Always)]
[JsonProperty("codename")]
public string Codename { get; set; }

/// <summary>
/// Gets or sets the workflow step's color.
/// </summary>
[JsonProperty("color", Required = Required.Always)]
[JsonProperty("color")]
public WorkflowStepColorModel Color { get; set; }

/// <summary>
/// Gets or sets the workflow steps that this step can transition to.
/// </summary>
[JsonProperty("transitions_to", Required = Required.Always)]
[JsonProperty("transitions_to")]
public IReadOnlyList<WorkflowStepTransitionToUpsertModel> TransitionsTo { get; set; }

/// <summary>
/// Gets or sets the roles which can work with an item in this step.
/// </summary>
[JsonProperty("role_ids", Required = Required.Always)]
[JsonProperty("role_ids")]
public IReadOnlyCollection<Guid> RoleIds { get; set; }
}
}

0 comments on commit 193c4b9

Please sign in to comment.