Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
Test create org with options
Browse files Browse the repository at this point in the history
when creating a new org we can pass a keyword list options
  • Loading branch information
SimonLab committed May 17, 2022
1 parent fee4d1c commit 572c6dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/gitea.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ defmodule Gitea do
end

@doc """
Create an organisation on Gitea
Create an organisation on Gitea.
The second argument opts is a keyword list value
and define the description, full_name and visibility
"""
@spec remote_org_create(String.t(), list()) :: {:ok, map} | {:error, any}
def remote_org_create(org_name, opts \\ []) do
Expand All @@ -65,7 +67,7 @@ defmodule Gitea do
end

@doc """
Create an organisation on Gitea
Delete an organisation on Gitea.
"""
@spec remote_org_delete(String.t()) :: {:ok, map} | {:error, any}
def remote_org_delete(org_name) do
Expand Down
12 changes: 12 additions & 0 deletions test/gitea_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ defmodule GiteaTest do
assert response_delete.status_code == 204
end

test "remote_org_create\2 create a new organistaion with options" do
org_name = "new_org2"

{:ok, response} =
Gitea.remote_org_create(org_name, description: "org desc", visibility: "public")

assert response.username
# delete organisation to allow test to run again
{:ok, response_delete} = Gitea.remote_org_delete(org_name)
assert response_delete.status_code == 204
end

test "remote_repo_create/3 creates a new repo on the gitea server" do
org_name = "myorg"
repo_name = test_repo()
Expand Down

0 comments on commit 572c6dc

Please sign in to comment.