diff --git a/lib/gitea.ex b/lib/gitea.ex index 077d65d..8a9a00f 100644 --- a/lib/gitea.ex +++ b/lib/gitea.ex @@ -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 @@ -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 diff --git a/test/gitea_test.exs b/test/gitea_test.exs index c56abe5..1c28c21 100644 --- a/test/gitea_test.exs +++ b/test/gitea_test.exs @@ -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()