public void ValidSignaturesArePromotable(bool expectedIsPromotable, PackageSignature signature)
            {
                signature.PackageKey = PackageKey;
                signature.Status     = PackageSignatureStatus.Unknown;

                // Act & Assert
                if (expectedIsPromotable)
                {
                    Assert.True(signature.IsPromotable());
                }
                else
                {
                    Assert.False(signature.IsPromotable());
                }
            }
            public void ThrowsIfSignatureIsInvalid()
            {
                var signature = new PackageSignature
                {
                    Status = PackageSignatureStatus.Invalid
                };

                Assert.Throws <ArgumentException>("signature", () => signature.IsPromotable());
            }
예제 #3
0
        /// <summary>
        /// Promote valid signatures from "Unknown" status to either "Valid" or "InGracePeriod".
        /// </summary>
        /// <param name="request">The validation request for the package whose signature should be promoted.</param>
        /// <param name="signatures">The valid signatures that should be promoted.</param>
        private void PromoteSignature(IValidationRequest request, PackageSignature signature)
        {
            var newSignatureStatus = signature.IsPromotable()
                                        ? PackageSignatureStatus.Valid
                                        : PackageSignatureStatus.InGracePeriod;

            _logger.LogInformation(
                "Promoting package {PackageId} {PackageVersion} signature from status {OldSignatureStatus} to status {NewSignatureStatus}",
                request.PackageId,
                request.PackageVersion,
                signature.Status,
                newSignatureStatus);

            signature.Status = newSignatureStatus;
        }