mirror of
https://github.com/Smaug123/gitea-repo-config
synced 2025-10-10 01:38:40 +00:00
Add tests (#60)
This commit is contained in:
@@ -61,16 +61,7 @@ module Client =
|
||||
member _.AdminCreateUser createUserOption =
|
||||
async {
|
||||
let! () = server.PostAndAsyncReply (fun reply -> AddUser (createUserOption, reply))
|
||||
let result = Gitea.User ()
|
||||
result.Email <- createUserOption.Email
|
||||
result.Restricted <- createUserOption.Restricted
|
||||
// TODO: what is this username used for anyway
|
||||
// result.LoginName <- createUserOption.Username
|
||||
result.Visibility <- createUserOption.Visibility
|
||||
result.Created <- createUserOption.CreatedAt
|
||||
result.FullName <- createUserOption.FullName
|
||||
result.LoginName <- createUserOption.LoginName
|
||||
return result
|
||||
return Operations.createdUser createUserOption
|
||||
}
|
||||
|> Async.StartAsTask
|
||||
|
||||
|
@@ -4,27 +4,23 @@ open System
|
||||
open System.Threading.Tasks
|
||||
open Gitea.Declarative
|
||||
|
||||
type BranchName = | BranchName of string
|
||||
module Types =
|
||||
|
||||
type BranchProtectionRule =
|
||||
{
|
||||
RequiredChecks : string Set
|
||||
}
|
||||
type BranchName = | BranchName of string
|
||||
|
||||
type NativeRepo =
|
||||
{
|
||||
BranchProtectionRules : (BranchName * BranchProtectionRule) list
|
||||
}
|
||||
type BranchProtectionRule =
|
||||
{
|
||||
RequiredChecks : string Set
|
||||
}
|
||||
|
||||
type Repo =
|
||||
| GitHubMirror of Uri
|
||||
| NativeRepo of NativeRepo
|
||||
type NativeRepo =
|
||||
{
|
||||
BranchProtectionRules : (BranchName * BranchProtectionRule) list
|
||||
}
|
||||
|
||||
type GiteaState =
|
||||
{
|
||||
Users : User Set
|
||||
Repositories : Map<User * RepoName, Repo>
|
||||
}
|
||||
type Repo =
|
||||
| GitHubMirror of Uri
|
||||
| NativeRepo of NativeRepo
|
||||
|
||||
/// Allows us to use handy record-updating syntax.
|
||||
/// (I have a considerable dislike of Moq and friends.)
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Domain.fs" />
|
||||
<Compile Include="Server.fs" />
|
||||
<Compile Include="Client.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
|
18
Gitea.InMemory/Server.fs
Normal file
18
Gitea.InMemory/Server.fs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace Gitea.InMemory
|
||||
|
||||
open Gitea.Declarative
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module Operations =
|
||||
let createdUser (createUserOption : Gitea.CreateUserOption) : Gitea.User =
|
||||
let result = Gitea.User ()
|
||||
result.Email <- createUserOption.Email
|
||||
result.Restricted <- createUserOption.Restricted
|
||||
// TODO: what is this username used for anyway
|
||||
// result.LoginName <- createUserOption.Username
|
||||
result.Visibility <- createUserOption.Visibility
|
||||
result.Created <- createUserOption.CreatedAt
|
||||
result.FullName <- createUserOption.FullName
|
||||
result.LoginName <- createUserOption.LoginName
|
||||
|
||||
result
|
Reference in New Issue
Block a user