From 51339b44ff93888d06212d3540143bb2b25dfbb3 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Wed, 19 Jun 2024 15:38:42 +0700 Subject: [PATCH] Add release channel creation testing --- .../dashboard/credential/new_live_test.exs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/polar_web/live/dashboard/credential/new_live_test.exs b/test/polar_web/live/dashboard/credential/new_live_test.exs index 6361780..88e58a0 100644 --- a/test/polar_web/live/dashboard/credential/new_live_test.exs +++ b/test/polar_web/live/dashboard/credential/new_live_test.exs @@ -44,5 +44,29 @@ defmodule PolarWeb.Dashboard.Credential.NewLiveTest do assert render(lv) =~ "can't be blank" end + + test "create new credential with testing release channel", %{conn: conn, space: space} do + {:ok, lv, _html} = live(conn, ~p"/dashboard/spaces/#{space.id}/credentials/new") + + lv + |> form("#new-credential-form", %{ + "credential" => %{ + "name" => "new-cred-test-testing", + "type" => "lxd", + "release_channel" => "testing", + "expires_in" => "2592000" + } + }) + |> render_submit() + + credential = Repo.get_by!(Space.Credential, name: "new-cred-test-testing") + + assert credential.release_channel == "testing" + + {:ok, lv, _html} = + live(conn, ~p"/dashboard/spaces/#{space.id}/credentials/#{credential.id}") + + assert render(lv) =~ "testing" + end end end