1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

@ -3,62 +3,63 @@ using Bit.Core.Settings;
using Microsoft.AspNetCore.Http;
using Xunit;
namespace Bit.Api.Test.Models.Request.Accounts;
public class PremiumRequestModelTests
namespace Bit.Api.Test.Models.Request.Accounts
{
public static IEnumerable<object[]> GetValidateData()
public class PremiumRequestModelTests
{
// 1. selfHosted
// 2. formFile
// 3. country
// 4. expected
public static IEnumerable<object[]> GetValidateData()
{
// 1. selfHosted
// 2. formFile
// 3. country
// 4. expected
yield return new object[] { true, null, null, false };
yield return new object[] { true, null, "US", false };
yield return new object[] { true, new NotImplementedFormFile(), null, false };
yield return new object[] { true, new NotImplementedFormFile(), "US", false };
yield return new object[] { true, null, null, false };
yield return new object[] { true, null, "US", false };
yield return new object[] { true, new NotImplementedFormFile(), null, false };
yield return new object[] { true, new NotImplementedFormFile(), "US", false };
yield return new object[] { false, null, null, false };
yield return new object[] { false, null, "US", true }; // Only true, cloud with null license AND a Country
yield return new object[] { false, new NotImplementedFormFile(), null, false };
yield return new object[] { false, new NotImplementedFormFile(), "US", false };
yield return new object[] { false, null, null, false };
yield return new object[] { false, null, "US", true }; // Only true, cloud with null license AND a Country
yield return new object[] { false, new NotImplementedFormFile(), null, false };
yield return new object[] { false, new NotImplementedFormFile(), "US", false };
}
[Theory]
[MemberData(nameof(GetValidateData))]
public void Validate_Success(bool selfHosted, IFormFile formFile, string country, bool expected)
{
var gs = new GlobalSettings
{
SelfHosted = selfHosted
};
var sut = new PremiumRequestModel
{
License = formFile,
Country = country,
};
Assert.Equal(expected, sut.Validate(gs));
}
}
[Theory]
[MemberData(nameof(GetValidateData))]
public void Validate_Success(bool selfHosted, IFormFile formFile, string country, bool expected)
public class NotImplementedFormFile : IFormFile
{
var gs = new GlobalSettings
{
SelfHosted = selfHosted
};
public string ContentType => throw new NotImplementedException();
var sut = new PremiumRequestModel
{
License = formFile,
Country = country,
};
public string ContentDisposition => throw new NotImplementedException();
Assert.Equal(expected, sut.Validate(gs));
public IHeaderDictionary Headers => throw new NotImplementedException();
public long Length => throw new NotImplementedException();
public string Name => throw new NotImplementedException();
public string FileName => throw new NotImplementedException();
public void CopyTo(Stream target) => throw new NotImplementedException();
public Task CopyToAsync(Stream target, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Stream OpenReadStream() => throw new NotImplementedException();
}
}
public class NotImplementedFormFile : IFormFile
{
public string ContentType => throw new NotImplementedException();
public string ContentDisposition => throw new NotImplementedException();
public IHeaderDictionary Headers => throw new NotImplementedException();
public long Length => throw new NotImplementedException();
public string Name => throw new NotImplementedException();
public string FileName => throw new NotImplementedException();
public void CopyTo(Stream target) => throw new NotImplementedException();
public Task CopyToAsync(Stream target, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Stream OpenReadStream() => throw new NotImplementedException();
}