Require production approval for question media
This commit is contained in:
@@ -49,6 +49,44 @@ public sealed class ContentPromotionTests
|
||||
Assert.False(QuestionPromotionCommand.IsEligible(new BsonDocument("IsPublished", false)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProductionPromotionFlagsMediaForSeparateApproval()
|
||||
{
|
||||
var updated = new DateTime(2026, 7, 30, 12, 0, 0, DateTimeKind.Utc);
|
||||
var source = new BsonDocument
|
||||
{
|
||||
["ExternalId"] = "media-question",
|
||||
["IsPublished"] = true,
|
||||
["FlaggedForReviewUtc"] = BsonNull.Value,
|
||||
["UpdatedUtc"] = updated,
|
||||
["Media"] = new BsonArray { ObjectId.GenerateNewId().ToString() }
|
||||
};
|
||||
|
||||
var prepared = QuestionPromotionCommand.PrepareForProduction(source);
|
||||
|
||||
Assert.Equal(updated, prepared["FlaggedForReviewUtc"].ToUniversalTime());
|
||||
Assert.Equal(QuestionPromotionCommand.ProductionMediaReviewReason, prepared["FlagReason"].AsString);
|
||||
Assert.Equal(QuestionPromotionCommand.ProductionMediaReviewActor, prepared["FlaggedByUserId"].AsString);
|
||||
Assert.True(source["FlaggedForReviewUtc"].IsBsonNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProductionPromotionLeavesMediaFreeQuestionApprovalStateAlone()
|
||||
{
|
||||
var source = new BsonDocument
|
||||
{
|
||||
["ExternalId"] = "text-question",
|
||||
["IsPublished"] = true,
|
||||
["FlaggedForReviewUtc"] = BsonNull.Value,
|
||||
["Media"] = new BsonArray()
|
||||
};
|
||||
|
||||
var prepared = QuestionPromotionCommand.PrepareForProduction(source);
|
||||
|
||||
Assert.True(prepared["FlaggedForReviewUtc"].IsBsonNull);
|
||||
Assert.False(prepared.Contains("FlagReason"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void QuestionMediaIdsSupportStoredApiUrlsAndRawIds()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user