Skip to content

Commit

Permalink
Add E2E for StartBroadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d committed Aug 1, 2023
1 parent b2dfa2c commit 4096c91
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 100 deletions.
4 changes: 2 additions & 2 deletions Vonage.Server.Test/Video/Broadcast/StartBroadcast/E2ETest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await this.Helper.VonageClient.BroadcastClient.StartBroadcastsAsync(StartBroadca
.WithMultiBroadcastTag("foo")
.Create())
.Should()
.BeSuccessAsync();
.BeSuccessAsync(SerializationTest.VerifyBroadcast);
}

[Fact]
Expand Down Expand Up @@ -78,7 +78,7 @@ await this.Helper.VonageClient.BroadcastClient.StartBroadcastsAsync(StartBroadca
})
.Create())
.Should()
.BeSuccessAsync();
.BeSuccessAsync(SerializationTest.VerifyBroadcast);
}
}
}
37 changes: 37 additions & 0 deletions Vonage.Server.Test/Video/Broadcast/StopBroadcast/E2ETest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Net;
using System.Threading.Tasks;
using Vonage.Common.Test.Extensions;
using Vonage.Server.Video.Broadcast.StopBroadcast;
using WireMock.ResponseBuilders;
using Xunit;

namespace Vonage.Server.Test.Video.Broadcast.StopBroadcast
{
[Trait("Category", "E2E")]
public class E2ETest : E2EBase
{
public E2ETest() : base(typeof(E2ETest).Namespace)
{
}

[Fact]
public async Task StopBroadcast()
{
this.Helper.Server.Given(WireMock.RequestBuilders.Request.Create()
.WithPath(
"/v2/project/5e782e3b-9f63-426f-bd2e-b7d618d546cd/broadcast/97425ae1-4722-4dbf-b395-6169f08ebab3/stop")
.WithHeader("Authorization", "Bearer *")
.UsingPost())
.RespondWith(Response.Create().WithStatusCode(HttpStatusCode.OK)
.WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200))));
await this.Helper.VonageClient.BroadcastClient.StopBroadcastAsync(StopBroadcastRequest
.Build()
.WithApplicationId(Guid.Parse("5e782e3b-9f63-426f-bd2e-b7d618d546cd"))
.WithBroadcastId(Guid.Parse("97425ae1-4722-4dbf-b395-6169f08ebab3"))
.Create())
.Should()
.BeSuccessAsync(SerializationTest.VerifyBroadcast);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,37 @@ public void ShouldDeserialize200() =>
this.helper.Serializer
.DeserializeObject<Server.Video.Broadcast.Broadcast>(this.helper.GetResponseJson())
.Should()
.BeSuccess(success =>
{
success.Id.Should().Be(new Guid("6c2bc486-0f4c-49cd-877c-7b609ec5dd19"));
success.SessionId.Should().Be("2_MX4xMDBfjE0Mzc2NzY1NDgwMTJ-TjMzfn4");
success.MultiBroadcastTag.Should().Be("broadcast_tag_provided");
success.ApplicationId.Should().Be(new Guid("af4cba75-3e4b-48d2-806b-7b9aecef7988"));
success.CreatedAt.Should().Be(1676124372);
success.UpdatedAt.Should().Be(1676624372);
success.MaxDuration.Should().Be(5400);
success.MaxBitrate.Should().Be(2000000);
success.Resolution.Should().Be("640x480");
success.HasAudio.Should().Be(true);
success.HasVideo.Should().Be(true);
success.StreamMode.Should().Be("manual");
success.Status.Should().Be(Server.Video.Broadcast.Broadcast.BroadcastStatus.Started);
success.BroadcastUrls.Hls.Should()
.Be(new Uri("http://server/fakepath/playlist.m3u8"));
success.BroadcastUrls.Rtmp.Should().HaveCount(1);
success.BroadcastUrls.Rtmp[0].Id.Should().Be(new Guid("432c916e-22fb-492e-b45b-b96ef3b90297"));
success.BroadcastUrls.Rtmp[0].Status.Should()
.Be(Server.Video.Broadcast.Broadcast.RtmpStatus.Live);
success.BroadcastUrls.Rtmp[0].StreamName.Should().Be("myfooapp");
success.BroadcastUrls.Rtmp[0].ServerUrl.Should().Be("rtmps://myfooserver/myfooapp");
success.Settings.Hls.Dvr.Should().BeTrue();
success.Settings.Hls.LowLatency.Should().BeTrue();
success.Streams.Should().HaveCount(1);
success.Streams[0].StreamId.Should().Be(new Guid("cbad214d-4712-40dd-88fd-82412bf66dd5"));
success.Streams[0].HasVideo.Should().BeTrue();
success.Streams[0].HasAudio.Should().BeTrue();
});
.BeSuccess(VerifyBroadcast);

internal static void VerifyBroadcast(Server.Video.Broadcast.Broadcast success)
{
success.Id.Should().Be(new Guid("6c2bc486-0f4c-49cd-877c-7b609ec5dd19"));
success.SessionId.Should().Be("2_MX4xMDBfjE0Mzc2NzY1NDgwMTJ-TjMzfn4");
success.MultiBroadcastTag.Should().Be("broadcast_tag_provided");
success.ApplicationId.Should().Be(new Guid("af4cba75-3e4b-48d2-806b-7b9aecef7988"));
success.CreatedAt.Should().Be(1676124372);
success.UpdatedAt.Should().Be(1676624372);
success.MaxDuration.Should().Be(5400);
success.MaxBitrate.Should().Be(2000000);
success.Resolution.Should().Be("640x480");
success.HasAudio.Should().Be(true);
success.HasVideo.Should().Be(true);
success.StreamMode.Should().Be("manual");
success.Status.Should().Be(Server.Video.Broadcast.Broadcast.BroadcastStatus.Started);
success.BroadcastUrls.Hls.Should()
.Be(new Uri("http://server/fakepath/playlist.m3u8"));
success.BroadcastUrls.Rtmp.Should().HaveCount(1);
success.BroadcastUrls.Rtmp[0].Id.Should().Be(new Guid("432c916e-22fb-492e-b45b-b96ef3b90297"));
success.BroadcastUrls.Rtmp[0].Status.Should()
.Be(Server.Video.Broadcast.Broadcast.RtmpStatus.Live);
success.BroadcastUrls.Rtmp[0].StreamName.Should().Be("myfooapp");
success.BroadcastUrls.Rtmp[0].ServerUrl.Should().Be("rtmps://myfooserver/myfooapp");
success.Settings.Hls.Dvr.Should().BeTrue();
success.Settings.Hls.LowLatency.Should().BeTrue();
success.Streams.Should().HaveCount(1);
success.Streams[0].StreamId.Should().Be(new Guid("cbad214d-4712-40dd-88fd-82412bf66dd5"));
success.Streams[0].HasVideo.Should().BeTrue();
success.Streams[0].HasAudio.Should().BeTrue();
}
}
}
68 changes: 0 additions & 68 deletions Vonage.Server.Test/Video/Broadcast/StopBroadcast/UseCaseTest.cs

This file was deleted.

0 comments on commit 4096c91

Please sign in to comment.