public async Task DisposeAsync() { await CleanupTags(AuthenticatedClient, VimeoSettings.VideoId); var video = await AuthenticatedClient.GetVideoAsync(VimeoSettings.VideoId); video.Tags.Count.ShouldBe(0); }
public async Task ShouldCorrectlyRetrievesVideosById() { await AuthenticatedClient.WithTempVideo(async clipId => { var video = await AuthenticatedClient.GetVideoAsync(clipId); video.ShouldNotBeNull(); video.Id.ShouldBe(clipId); }); }
public async Task ShouldCorrectlyGetVideoWithFields() { await AuthenticatedClient.WithTempVideo(async clipId => { var video = await AuthenticatedClient.GetVideoAsync(clipId, new[] { "uri", "name" }); video.ShouldNotBeNull(); video.Uri.ShouldNotBeNull(); video.Name.ShouldNotBeNull(); video.Pictures.ShouldBeNull(); }); }
public async Task ShouldCorrectlyAssignEmbedPresetToVideo() { if (VimeoSettings.EmbedPresetId == 0) { return; } await AuthenticatedClient.WithTempVideo(async clipId => { await AuthenticatedClient.AssignEmbedPresetToVideoAsync(clipId, VimeoSettings.EmbedPresetId); var video = await AuthenticatedClient.GetVideoAsync(clipId, new[] { "embed_presets" }); video.ShouldNotBeNull(); video.EmbedPresets.ShouldNotBeNull(); video.EmbedPresets.Id.ShouldBe(VimeoSettings.EmbedPresetId); }); }
public async Task TagInteractionTest() { await AuthenticatedClient.WithTempVideo(async clipId => { var tag = await AuthenticatedClient.AddVideoTagAsync(clipId, "test-tag1"); tag.ShouldNotBeNull(); tag.Id.ShouldBe("test-tag1"); tag.Name.ShouldBe("test-tag1"); tag.Canonical.ShouldBe("test-tag1"); tag.Uri.ShouldNotBeEmpty(); tag.Metadata.ShouldNotBeNull(); tag.Metadata.Connections.ShouldNotBeNull(); tag.Metadata.Connections.Videos.Uri.ShouldNotBeEmpty(); tag.Metadata.Connections.Videos.Options.ShouldNotBeEmpty(); tag.Metadata.Connections.Videos.Total.ShouldBeGreaterThan(0); var video = await AuthenticatedClient.GetVideoAsync(clipId); while (video.Status == "uploading") { _testOutput.WriteLine("Video is uploading..."); Thread.Sleep(5000); video = await AuthenticatedClient.GetVideoAsync(clipId); } video.Tags.Count.ShouldBe(1); var tagResult = await AuthenticatedClient.GetVideoTagAsync("test-tag1"); tagResult.Id.ShouldBe("test-tag1"); var videoResult = await AuthenticatedClient.GetVideoByTag("test", 1, 10, GetVideoByTagSort.Name, GetVideoByTagDirection.Asc, new[] { "uri", "name" }); videoResult.Page.ShouldBe(1); videoResult.PerPage.ShouldBe(10); videoResult.Data.Count.ShouldBeGreaterThan(0); videoResult.Data[0].Name.ShouldNotBeEmpty(); videoResult.Data[0].Uri.ShouldNotBeEmpty(); var tags = await AuthenticatedClient.GetVideoTags(clipId); foreach (var t in tags.Data) { await AuthenticatedClient.DeleteVideoTagAsync(clipId, t.Id); } }); }
public async Task ShouldCorrectlyAddTagVideoTag() { var tag = await AuthenticatedClient.AddVideoTagAsync(VimeoSettings.VideoId, "test-tag1"); tag.ShouldNotBeNull(); tag.Id.ShouldBe("test-tag1"); tag.Name.ShouldBe("test-tag1"); tag.Canonical.ShouldBe("test-tag1"); tag.Uri.ShouldNotBeEmpty(); tag.Metadata.ShouldNotBeNull(); tag.Metadata.Connections.ShouldNotBeNull(); tag.Metadata.Connections.Videos.Uri.ShouldNotBeEmpty(); tag.Metadata.Connections.Videos.Options.ShouldNotBeEmpty(); tag.Metadata.Connections.Videos.Total.ShouldBeGreaterThan(0); var video = await AuthenticatedClient.GetVideoAsync(VimeoSettings.VideoId); video.Tags.Count.ShouldBe(1); }
public async Task ShouldCorrectlyUpdateVideoEmbedPrivacy() { await AuthenticatedClient.WithTempVideo(async clipId => { var video = await AuthenticatedClient.GetVideoAsync(clipId); video.Privacy.EmbedPrivacy.ShouldBe(VideoEmbedPrivacyEnum.Public); await AuthenticatedClient.UpdateVideoMetadataAsync(clipId, new VideoUpdateMetadata { EmbedPrivacy = VideoEmbedPrivacyEnum.Private }); video = await AuthenticatedClient.GetVideoAsync(clipId); video.Privacy.EmbedPrivacy.ShouldBe(VideoEmbedPrivacyEnum.Private); await AuthenticatedClient.UpdateVideoMetadataAsync(clipId, new VideoUpdateMetadata { EmbedPrivacy = VideoEmbedPrivacyEnum.Public }); video = await AuthenticatedClient.GetVideoAsync(clipId); video.Privacy.EmbedPrivacy.ShouldBe(VideoEmbedPrivacyEnum.Public); }); }
public async Task ShouldCorrectlyUnassignEmbedPresetFromVideo() { if (VimeoSettings.EmbedPresetId == 0) { return; } await AuthenticatedClient.WithTempVideo(async clipId => { var video = await AuthenticatedClient.GetVideoAsync(clipId, new[] { "embed_presets" }); var oldPresetId = video?.EmbedPresets?.Id; await AuthenticatedClient.UnassignEmbedPresetFromVideoAsync(clipId, VimeoSettings.EmbedPresetId); video = await AuthenticatedClient.GetVideoAsync(clipId, new[] { "embed_presets" }); video.ShouldNotBeNull(); if (oldPresetId == VimeoSettings.EmbedPresetId) { video.EmbedPresets.ShouldBeNull(); } else { video.EmbedPresets?.Id.ShouldBe(oldPresetId); } }); }
public async Task ShouldCorrectlyWorkWithDomainsForEmbedding() { await AuthenticatedClient.WithTempVideo(async clipId => { var account = await AuthenticatedClient.GetAccountInformationAsync(); if (account.AccountType == AccountTypeEnum.Basic || account.AccountType == AccountTypeEnum.Unknown) { // Skip test if account type does not support domains whitelist return; } await AuthenticatedClient.UpdateVideoMetadataAsync(clipId, new VideoUpdateMetadata { EmbedPrivacy = VideoEmbedPrivacyEnum.Whitelist }); var video = await AuthenticatedClient.GetVideoAsync(clipId); video.Privacy.EmbedPrivacy.ShouldBe(VideoEmbedPrivacyEnum.Whitelist); await AuthenticatedClient.AllowEmbedVideoOnDomainAsync(clipId, "example.com"); var domains = await AuthenticatedClient.GetAllowedDomainsForEmbeddingVideoAsync(clipId); domains.Data.ShouldNotBeNull(); domains.Data.Count.ShouldBe(1); domains.Data[0].ShouldNotBeNull(); domains.Data[0].Domain.ShouldBe("example.com"); await AuthenticatedClient.DisallowEmbedVideoOnDomainAsync(clipId, "example.com"); domains = await AuthenticatedClient.GetAllowedDomainsForEmbeddingVideoAsync(clipId); domains.Data.ShouldNotBeNull(); domains.Data.Count.ShouldBe(0); await AuthenticatedClient.UpdateVideoMetadataAsync(clipId, new VideoUpdateMetadata { EmbedPrivacy = VideoEmbedPrivacyEnum.Public }); }); }