Skip to content

Commit

Permalink
EN-238 Update web spotlight activation model
Browse files Browse the repository at this point in the history
  • Loading branch information
František Záhora authored and František Záhora committed Jul 10, 2024
1 parent e0c9db6 commit ad3b47a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Kontent.Ai.Management.Models.WebSpotlight;
using Kontent.Ai.Management.Models.Shared;
using Kontent.Ai.Management.Models.WebSpotlight;
using Kontent.Ai.Management.Tests.Base;
using System;
using System.Net.Http;
Expand Down Expand Up @@ -31,14 +32,36 @@ public async void ActivateWebSpotlight_Returns_EnabledStatusAndRootTypeId()
}

[Fact]
public async void ActivateWebSpotlight_WithProvidedValidRootType_Returns_EnabledStatusAndRootTypeId()
public async void ActivateWebSpotlight_WithProvidedValidRootTypeById_Returns_EnabledStatusAndRootTypeId()
{
var client = _scenario
.WithResponses("ActivationWebSpotlightWithProvidedRootTypeIdResponse.json")
.CreateManagementClient();

var rootTypeId = Guid.Parse("3660e894-bae8-4dcd-9d3e-5fc9205c2ece");
var webSpotlightActivateModel = new WebSpotlightActivateModel { RootTypeId = rootTypeId };
var reference = Reference.ById(rootTypeId);
var webSpotlightActivateModel = new WebSpotlightActivateModel { RootType = reference };

await client.ActivateWebSpotlightAsync(webSpotlightActivateModel);

_scenario
.CreateExpectations()
.HttpMethod(HttpMethod.Put)
.RequestPayload(webSpotlightActivateModel)
.Url(WebSpotlightBaseUrl)
.Validate();
}

[Fact]
public async void ActivateWebSpotlight_WithProvidedValidRootTypeByCodename_Returns_EnabledStatusAndRootTypeId()
{
var client = _scenario
.WithResponses("ActivationWebSpotlightWithProvidedRootTypeIdResponse.json")
.CreateManagementClient();

var rootTypeCodename = "root_type_codename";
var reference = Reference.ByCodename(rootTypeCodename);
var webSpotlightActivateModel = new WebSpotlightActivateModel { RootType = reference };

await client.ActivateWebSpotlightAsync(webSpotlightActivateModel);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System;
using Kontent.Ai.Management.Models.Shared;
using Newtonsoft.Json;

namespace Kontent.Ai.Management.Models.WebSpotlight;

Expand All @@ -11,6 +11,6 @@ public class WebSpotlightActivateModel
/// <summary>
/// Gets or sets the web spotlight's Root Type ID.
/// </summary>
[JsonProperty("root_type_id")]
public Guid? RootTypeId { get; set; }
[JsonProperty("root_type")]
public Reference RootType { get; set; }
}

0 comments on commit ad3b47a

Please sign in to comment.