Skip to content

Commit

Permalink
Merge pull request #34 from microsoft/dev
Browse files Browse the repository at this point in the history
Fix minor issues
  • Loading branch information
xpouyat authored Jul 10, 2024
2 parents e75155a + 8ee389b commit bb9fa3e
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 40 deletions.
12 changes: 6 additions & 6 deletions MK.IO.Tests/AssetsOperationsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public AssetsOperationsTests()

[Theory]
[InlineData(null)]
public async Task Create_WithNull(string name)
public void Create_WithNull(string name)
{
// Arrange
var assetsOperations = new AssetsOperations(mockClient.Object);
Expand All @@ -30,7 +30,7 @@ public async Task Create_WithNull(string name)

[Theory]
[InlineData("")]
public async Task Create_WithEmpty(string name)
public void Create_WithEmpty(string name)
{
// Arrange
var assetsOperations = new AssetsOperations(mockClient.Object);
Expand All @@ -52,7 +52,7 @@ public async Task Create_WithEmpty(string name)
[InlineData("Name-123")]
[InlineData("a")]
[InlineData("12")]
public async Task Create_ContainerNameError(string name)
public void Create_ContainerNameError(string name)
{
// Arrange
var assetsOperations = new AssetsOperations(mockClient.Object);
Expand All @@ -65,7 +65,7 @@ public async Task Create_ContainerNameError(string name)
[InlineData("name-123")]
[InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")]
[InlineData(null)]
public async Task Create_ContainerNameOK(string name)
public void Create_ContainerNameOK(string name)
{
var mockClient2 = new Mock<MKIOClient>("subscriptionname", Constants.jwtFakeToken);

Expand All @@ -89,7 +89,7 @@ public async Task Create_ContainerNameOK(string name)

[Theory]
[InlineData("{\"name\":\"ignite-truncated-StandardEncoder-H264SingleBitrate720p-98b7c74252\",\"id\":\"/subscriptions/52907a2e-ab43-43ba-8b9f-8cb78285f665/resourceGroups/default/providers/Microsoft.Media/mediaservices/mkiotest/assets/ignite-truncated-StandardEncoder-H264SingleBitrate720p-98b7c74252\",\"type\":\"Microsoft.Media/mediaservices/assets\",\"properties\":{\"assetId\":\"bcf8655e-9f8a-4f97-8fb6-c81962d859dd\",\"created\":\"2024-03-26T14:51:19.125280Z\",\"lastModified\":\"2024-03-26T14:51:22.180123Z\",\"alternateId\":\"\",\"description\":null,\"container\":\"asset-ac71836f-cc24-4614-af60-2fe2ae7f811e\",\"storageAccountName\":\"amsxpfrstorage\",\"storageEncryptionFormat\":null,\"encryptionScope\":null,\"containerDeletionPolicy\":\"Retain\"},\"labels\":{},\"systemData\":{\"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2024-03-26T14:51:19.125280Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-03-26T14:51:22.180123Z\"},\"supplemental\":{\"operation\":\"get\",\"subscription\":{\"id\":\"bf747f59-771a-4e9b-a6cd-59351c4a71d2\",\"name\":\"mkiotest\"}}}")]
public async Task Create_DeserializationOK(string json)
public void Create_DeserializationOK(string json)
{
var mockClient2 = new Mock<MKIOClient>("subscriptionname", Constants.jwtFakeToken);

Expand All @@ -113,7 +113,7 @@ public async Task Create_DeserializationOK(string json)

[Theory]
[InlineData("{\"name\":\"ignite-truncated-StandardEncoder-H264SingleBitrate720p-98b7c74252\",\"id\":\"/subscriptions/52907a2e-ab43-43ba-8b9f-8cb78285f665/resourceGroups/default/providers/Microsoft.Media/mediaservices/mkiotest/assets/ignite-truncated-StandardEncoder-H264SingleBitrate720p-98b7c74252\",\"type\":\"Microsoft.Media/mediaservices/assets\",\"properties\":{\"assetId\":\"bcf8655e-9f8a-4f97-8fb6-c81962d859dd\",\"created\":\"2024-03-26T14:51:19.125280Z\",\"lastModified\":\"2024-03-26T14:51:22.180123Z\",\"alternateId\":\"\",\"description\":null,\"container\":\"asset-ac71836f-cc24-4614-af60-2fe2ae7f811e\",\"storageAccountName\":\"amsxpfrstorage\",\"storageEncryptionFormat\":null,\"encryptionScope\":null,\"containerDeletionPolicy\":\"Rein\"},\"labels\":{},\"systemData\":{\"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2024-03-26T14:51:19.125280Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-03-26T14:51:22.180123Z\"},\"supplemental\":{\"operation\":\"get\",\"subscription\":{\"id\":\"bf747f59-771a-4e9b-a6cd-59351c4a71d2\",\"name\":\"mkiotest\"}}}")]
public async Task Create_DeserializationError(string json)
public void Create_DeserializationError(string json)
{
var mockClient2 = new Mock<MKIOClient>("subscriptionname", Constants.jwtFakeToken);

Expand Down
4 changes: 2 additions & 2 deletions MK.IO.Tests/ClientOperationsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public ClientOperationsTests()

[Theory]
[InlineData(null)]
public async Task CreateClient_WithNull(string name)
public void CreateClient_WithNull(string name)
{

// act & assert
Expand All @@ -26,7 +26,7 @@ public async Task CreateClient_WithNull(string name)

[Theory]
[InlineData("AGDTSBDH45DGD")]
public async Task CreateClient_WithNotAJwt(string token)
public void CreateClient_WithNotAJwt(string token)
{

// act & assert
Expand Down
8 changes: 4 additions & 4 deletions MK.IO.Tests/ContentKeyPoliciesOperationsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ContentKeyPoliciesOperationsTests()

[Theory]
[InlineData(null)]
public async Task Create_WithNull(string name)
public void Create_WithNull(string name)
{
// Arrange
var operations = new ContentKeyPoliciesOperations(mockClient.Object);
Expand All @@ -31,7 +31,7 @@ public async Task Create_WithNull(string name)
[Theory]
[InlineData("")]
[InlineData("name with space")]
public async Task Create_WithEmptyOrSpace(string name)
public void Create_WithEmptyOrSpace(string name)
{
// Arrange
var operations = new ContentKeyPoliciesOperations(mockClient.Object);
Expand All @@ -42,7 +42,7 @@ public async Task Create_WithEmptyOrSpace(string name)

[Theory]
[InlineData("{\"name\":\"testpolcreate\",\"id\":\"/subscriptions/52907a2e-ab43-43ba-8b9f-8cb78285f665/resourceGroups/default/providers/Microsoft.Media/mediaservices/mkiotest/contentKeyPolicies/testpolcreate\",\"type\":\"Microsoft.Media/mediaservices/contentKeyPolicies\",\"supplemental\":{\"id\":\"3b2c47e3-e5a6-408c-9ff4-45fcf7396885\",\"state\":\"Created\"},\"properties\":{\"options\":[{\"name\":\"option1\",\"restriction\":{\"issuer\":\"issuer\",\"audience\":\"audience\",\"@odata.type\":\"#Microsoft.Media.ContentKeyPolicyTokenRestriction\",\"requiredClaims\":[{\"claimType\":\"urn:microsoft:azure:mediaservices:contentkeyidentifier\"}],\"restrictionTokenType\":\"Jwt\",\"primaryVerificationKey\":{\"keyValue\":\"\",\"@odata.type\":\"#Microsoft.Media.ContentKeyPolicySymmetricTokenKey\"},\"alternateVerificationKeys\":[]},\"configuration\":{\"@odata.type\":\"#Microsoft.Media.ContentKeyPolicyWidevineConfiguration\",\"widevineTemplate\":\"{}\"}}],\"description\":\"Mydescription\",\"created\":\"2024-06-25T17:14:16.861426Z\",\"lastModified\":\"2024-06-25T17:14:16.861441Z\"},\"systemData\":{\"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2024-06-25T17:14:16.861426Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-06-25T17:14:16.861441Z\"}}")]
public async Task Create_DeserializationOK(string json)
public void Create_DeserializationOK(string json)
{
var mockClient2 = new Mock<MKIOClient>("subscriptionname", Constants.jwtFakeToken);

Expand All @@ -66,7 +66,7 @@ public async Task Create_DeserializationOK(string json)

[Theory]
[InlineData("{\"name\":\"testpolcreate\",\"id\":\"/subscriptions/52907a2e-ab43-43ba-8b9f-8cb78285f665/resourceGroups/default/providers/Microsoft.Media/mediaservices/mkiotest/contentKeyPolicies/testpolcreate\",\"type\":\"Microsoft.Media/mediaservices/contentKeyPolicies\",\"supplemental\":{\"id\":\"3b2c47e3-e5a6-408c-9ff4-45fcf7396885\",\"state\":\"Created\"},\"properties\":{\"options\":[{\"name\":\"option1\",\"restriction\":{\"issuer\":\"issuer\",\"audience\":\"audience\",\"@odata.type\":\"#Microsoft.Media.ContentKeyPolicyTokenRestriction\",\"requiredClaims\":[{\"claimType\":\"urn:microsoft:azure:mediaservices:contentkeyidentifier\"}],\"restrictionTokenType\":\"Jwt\",\"primaryVerificationKey\":{\"keyValue\":\"\",\"@odata.type\":\"#Microsoft.Media.ContentKeyPolicySymmetricTokenKey\"},\"alternateVerificationKeys\":[]},\"configuration\":{\"@odata.type\":\"#Microsoft.Media.ContentKeyPolicyWidevineConfiguration\",\"widevineTemplate\":\"{}\"}}],\"description\":\"Mydescription\",\"created\":\"XXXXXX\",\"lastModified\":\"2024-06-25T17:14:16.861441Z\"},\"systemData\":{\"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2024-06-25T17:14:16.861426Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-06-25T17:14:16.861441Z\"}}")]
public async Task Create_DeserializationFormatError(string json)
public void Create_DeserializationFormatError(string json)
{
var mockClient2 = new Mock<MKIOClient>("subscriptionname", Constants.jwtFakeToken);

Expand Down
8 changes: 4 additions & 4 deletions MK.IO.Tests/JobsOperationsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public JobsOperationsTests()

[Theory]
[InlineData(null)]
public async Task Create_WithNull(string name)
public void Create_WithNull(string name)
{
// Arrange
var jobsOperations = new JobsOperations(_mockClient.Object);
Expand All @@ -46,7 +46,7 @@ public async Task Create_WithNull(string name)

[Theory]
[InlineData("")]
public async Task Create_WithEmpty(string name)
public void Create_WithEmpty(string name)
{
// Arrange
var jobsOperations = new JobsOperations(_mockClient.Object);
Expand All @@ -63,7 +63,7 @@ public async Task Create_WithEmpty(string name)
[InlineData("job-123.4")]
[InlineData("-job-123")]
[InlineData("job-123-")]
public async Task Create_JobNameErrorInName(string name)
public void Create_JobNameErrorInName(string name)
{
// Arrange
var jobsOperations = new JobsOperations(_mockClient.Object);
Expand Down Expand Up @@ -120,7 +120,7 @@ public async Task Create_DeserializationOK(string json)
[Theory]
[InlineData("{\"name\":\"live-to-mp4-6a3413a8\",\"id\":\"/subscriptions/52907a2e-ab43-43ba-8b9f-8cb78285f665/resourceGroups/default/providers/Microsoft.Media/mediaservices/mkiotest/transforms/ConverterAllBitrateInterleaved/jobs/live-to-mp4-6a3413a8\",\"type\":\"Microsoft.Media/mediaservices/transforms/jobs\",\"properties\":{\"created\":\"2024-06-18T11:58:47.351891Z\",\"description\":\"Myjobwhichprocesses'asset-ec0688cc'to'asset-ec0688cc-mp4'with'ConverterAllBitrateInterleaved'transform.\",\"lastModified\":\"2024-06-18T11:59:06.511738Z\",\"priority\":\"Normal\",\"state\":\"FinishedXX\",\"input\":{\"files\":[\"*\"],\"assetName\":\"asset-ec0688cc\",\"@odata.type\":\"#Microsoft.Media.JobInputAssetXX\"},\"outputs\":[{\"label\":\"BuiltInAssetConverterPreset_0\",\"state\":\"Finhed\",\"endTime\":\"2024-06-18T11:59:06.394517Z\",\"progress\":100,\"assetName\":\"asset-ec0688cc-mp4\",\"@odata.type\":\"#Microsoft.Media.JobOutputAsset\"}],\"endTime\":\"2024-06-18T11:59:06.394517Z\"},\"systemData\":{\"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2024-06-18T11:58:47.351891Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-06-18T11:59:06.511738Z\"},\"supplemental\":{\"operation\":\"get\",\"subscription\":{\"id\":\"bf747f59-771a-4e9b-a6cd-59351c4a71d2\",\"name\":\"mkiotest\"}}}")]
[InlineData("{\"name\":\"job-7326300f\",\"id\":\"/subscriptions/52907a2e-ab43-43ba-8b9f-8cb78285f665/resourceGroups/default/providers/Microsoft.Media/mediaservices/mkiotest/transforms/simpletransformsd/jobs/job-7326300f\",\"type\":\"Microsoft.Media/mediaservices/transforms/jobs\",\"properties\":{\"created\":\"2024-03-27T15:33:58.451407Z\",\"description\":\"Mysdencodingjob\",\"lastModified\":\"2024-03-27T15:36:43.395374Z\",\"priority\":\"High\",\"state\":\"FinishedXXX\",\"input\":{\"files\":[\"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4\"],\"@odata.type\":\"#Microsoft.Media.JobInputHttpXX\"},\"outputs\":[{\"label\":\"BuiltInStandardEncoderPreset_0\",\"state\":\"Finished\",\"endTime\":\"2024-03-27T15:36:36.000000Z\",\"progress\":100,\"assetName\":\"output-b19d8b84\",\"@odata.type\":\"#Microsoft.Media.JobOutputAsset\",\"startTime\":\"2024-03-27T15:36:31.000000Z\"}],\"startTime\":\"2024-03-27T15:36:31.000000Z\",\"endTime\":\"2024-03-27T15:36:36.000000Z\"},\"systemData\":{\"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2024-03-27T15:33:58.451407Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-03-27T15:36:43.395374Z\"},\"supplemental\":{\"operation\":\"get\",\"subscription\":{\"id\":\"bf747f59-771a-4e9b-a6cd-59351c4a71d2\",\"name\":\"mkiotest\"}}}")]
public async Task Create_DeserializationError(string json)
public void Create_DeserializationError(string json)
{
var mockClient2 = new Mock<MKIOClient>("subscriptionname", Constants.jwtFakeToken);

Expand Down
6 changes: 3 additions & 3 deletions MK.IO/MK.IO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<Description>A .NET client SDK for MediaKind MK.IO.</Description>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<RepositoryUrl>https://github.com/microsoft/MK.IO</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/microsoft/MK.IO/blob/main/README.md</PackageProjectUrl>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<AssemblyVersion>2.0.1.0</AssemblyVersion>
<FileVersion>2.0.1.0</FileVersion>
<Title>A .NET client SDK for MediaKind MK.IO.</Title>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
2 changes: 1 addition & 1 deletion MK.IO/Management/YourProfile/Models/UserProfileSpecV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class UserProfileSpecV1
/// Email address used for login
/// </summary>
/// <value>Email address used for login</value>
[JsonProperty("spec")]
[JsonProperty("loginEmail")]
public string LoginEmail { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,11 @@ public class UserTokenWithSecretSchema
/// </summary>
[JsonProperty(PropertyName = "spec")]
public UserTokenSpecSchema Spec { get; set; }


public static UserTokenWithSecretSchema FromJson(string json)
{
return JsonConvert.DeserializeObject<UserTokenWithSecretSchema>(json, ConverterLE.Settings) ?? throw new Exception("Error with UserTokenWithSecretSchema deserialization");
}
}
}
2 changes: 1 addition & 1 deletion MK.IO/Management/YourProfile/YourProfileOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public UserTokenWithSecretSchema RequestNewToken(CreateTokenSchema tokenRequest)
public async Task<UserTokenWithSecretSchema> RequestNewTokenAsync(CreateTokenSchema tokenRequest, CancellationToken cancellationToken = default)
{
string responseContent = await Client.CreateObjectPostAsync(Client._baseUrl + _yourProfileTokensApiUrl, tokenRequest.ToJson(), cancellationToken);
return JsonConvert.DeserializeObject<UserTokenWithSecretSchema>(responseContent, ConverterLE.Settings) ?? throw new Exception("Error with UserTokenWithSecretSchema deserialization");
return UserTokenWithSecretSchema.FromJson(responseContent) ?? throw new Exception("Error with UserTokenWithSecretSchema deserialization");
}

/// <inheritdoc/>
Expand Down
2 changes: 1 addition & 1 deletion MK.IO/Transform/Models/TransformPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace MK.IO.Models
[JsonConverter(typeof(JsonSubtypes), "@odata.type")]
[JsonSubtypes.KnownSubType(typeof(BuiltInStandardEncoderPreset), "#Microsoft.Media.BuiltInStandardEncoderPreset")]
[JsonSubtypes.KnownSubType(typeof(BuiltInAssetConverterPreset), "#Microsoft.Media.BuiltInAssetConverterPreset")]
[JsonSubtypes.KnownSubType(typeof(ThumbnailGeneratorPreset), "#Microsoft.Media.ThumbnailGeneratorPreset")]
[JsonSubtypes.KnownSubType(typeof(ThumbnailGeneratorPreset), "#MediaKind.ThumbnailGeneratorPreset")]

//
// Summary:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ This sample code does the following :
- create the output asset
- create/update a transform
- submit an encoding job
- create/update a transform for thumbnail
- submit a job for thumbnail generation
- create a download locator for the thumbnail and list the Url
- create/update a transform for thumbnails
- submit a job to generate a thumbnails sprite
- create a download locator for the thumbnails sprite and thumbnails vtt and list the Urls
- create a streaming locator for the encoded asset
- create and start a streaming endpoint if there is none
- list the streaming urls and test player urls.
Expand Down
Loading

0 comments on commit bb9fa3e

Please sign in to comment.