Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KpiStore: change to use HttpPost instead of HttpPut #32

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,5 @@ ModelManifest.xml
/samples/EPiServer.Templates.Alloy.Mvc/App_Code/**
/nupkgs
modules
zipoutput
zipoutput
/samples/QuickSilver/EPiServer.Reference.Commerce.Site/App_Data/**
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="../DependencyVersions.props" Condition="'$(DependencyVersions_props)' == ''" />
<Import Project="../../../build/DependencyVersions.props" Condition="'$(DependencyVersions_props)' == ''" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
Expand All @@ -13,8 +13,8 @@
<EmbeddedResource Include="lang\**\*" />
<PackageReference Include="Adyen" Version="5.7.0" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="EPiServer.Cms" Version="12.6.0" />
<PackageReference Include="EPiServer.Commerce" Version="14.3.0" />
<PackageReference Include="EPiServer.Cms" Version="$(CmsUiVersionCommon)" />
<PackageReference Include="EPiServer.Commerce" Version="$(CmsCommerceVersionCommon)" />
<PackageReference Include="EPiServer.Personalization.Commerce" Version="4.0.5" />
<PackageReference Include="EPiServer.Tracking.Commerce" Version="4.0.5" />
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00014" />
Expand Down
4 changes: 2 additions & 2 deletions src/EPiServer.Marketing.Testing.Web/Controllers/KpiStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public RestResult Get()
/// <param name="id"></param>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPut]
public ActionResult Put([FromBody]KpiPutRequest request)
[HttpPost]
public ActionResult Post([FromBody]KpiPutRequest request)
{
List<IKpi> validKpiInstances = new List<IKpi>();
Dictionary<string, string> kpiErrors = new Dictionary<string, string>();
Expand Down
8 changes: 4 additions & 4 deletions test/EPiServer.Marketing.Testing.Test/Web/KpiStoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void Put_With_Null_Entity()
{
var testClass = GetUnitUnderTest();
var request = new KpiPutRequest { entity = "", id = "" };
var retResult = testClass.Put(request) as RestResult;
var retResult = testClass.Post(request) as RestResult;

var responseDataStatus = (bool)retResult.Data.GetType().GetProperty("status").GetValue(retResult.Data, null);

Expand All @@ -78,7 +78,7 @@ public void Put_With_Non_Null_Entity_Throws_Exception()
entity = "{\"kpiType\": \"EPiServer.Marketing.KPI.Common.ContentComparatorKPI, EPiServer.Marketing.KPI, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7\",\"ConversionPage\": \"16\",\"CurrentContent\": \"6_197\"}",
id = ""
};
var retResult = testClass.Put(request) as RestResult;
var retResult = testClass.Post(request) as RestResult;

var responseDataStatus = (bool)retResult.Data.GetType().GetProperty("status").GetValue(retResult.Data, null);

Expand Down Expand Up @@ -113,7 +113,7 @@ public void Put_Returns_Correct_Weight_For_Each_Kpi()
_kpiWebRepoMock.Setup(call => call.ActivateKpiInstance(It.IsAny<Dictionary<string, string>>())).Returns(sticky.Object);

var request = new KpiPutRequest { entity = "", id = "KpiFormData" };
var retResult = testClass.Put(request) as RestResult;
var retResult = testClass.Post(request) as RestResult;

var responseDataObj= (Dictionary<Guid,string>)retResult.Data.GetType().GetProperty("obj").GetValue(retResult.Data, null);

Expand Down Expand Up @@ -149,7 +149,7 @@ public void Put_With_Duplicate_Kpis_and_Values_Returns_Proper_Errors()
_kpiWebRepoMock.Setup(call => call.ActivateKpiInstance(It.IsAny<Dictionary<string, string>>())).Returns(sticky.Object);

var request = new KpiPutRequest { entity = "", id = "KpiFormData" };
var retResult = testClass.Put(request) as RestResult;
var retResult = testClass.Post(request) as RestResult;

var responseDataErrors = JsonConvert.DeserializeObject<Dictionary<string,string>>(retResult.Data.GetType().GetProperty("errors").GetValue(retResult.Data, null).ToString());

Expand Down