Modify test utils to use teams test factories

This commit is contained in:
Adrian Gruntkowski 2024-11-11 13:07:31 +01:00
parent 98bc3e7554
commit 5eb8754782
3 changed files with 14 additions and 9 deletions

View File

@ -150,10 +150,12 @@ defmodule PlausibleWeb.BillingControllerTest do
|> get(Routes.billing_path(conn, :upgrade_to_enterprise_plan))
|> html_response(200)
{:ok, team} = Plausible.Teams.get_by_owner(user)
assert %{
"disableLogout" => true,
"email" => user.email,
"passthrough" => user.id,
"passthrough" => "user:#{user.id};team:#{team.id}",
"product" => @configured_enterprise_plan_paddle_plan_id,
"success" => Routes.billing_path(PlausibleWeb.Endpoint, :upgrade_success),
"theme" => "none"
@ -321,10 +323,12 @@ defmodule PlausibleWeb.BillingControllerTest do
|> get(Routes.billing_path(conn, :upgrade_to_enterprise_plan))
|> html_response(200)
{:ok, team} = Plausible.Teams.get_by_owner(user)
assert %{
"disableLogout" => true,
"email" => user.email,
"passthrough" => user.id,
"passthrough" => "user:#{user.id};team:#{team.id}",
"product" => @configured_enterprise_plan_paddle_plan_id,
"success" => Routes.billing_path(PlausibleWeb.Endpoint, :upgrade_success),
"theme" => "none"

View File

@ -197,10 +197,12 @@ defmodule PlausibleWeb.Live.ChoosePlanTest do
set_slider(lv, "200k")
doc = element(lv, @yearly_interval_button) |> render_click()
{:ok, team} = Plausible.Teams.get_by_owner(user)
assert %{
"disableLogout" => true,
"email" => user.email,
"passthrough" => user.id,
"passthrough" => "user:#{user.id};team:#{team.id}",
"product" => @v4_growth_200k_yearly_plan_id,
"success" => Routes.billing_path(PlausibleWeb.Endpoint, :upgrade_success),
"theme" => "none"
@ -1069,10 +1071,12 @@ defmodule PlausibleWeb.Live.ChoosePlanTest do
set_slider(lv, "200k")
doc = element(lv, @yearly_interval_button) |> render_click()
{:ok, team} = Plausible.Teams.get_by_owner(user)
assert %{
"disableLogout" => true,
"email" => user.email,
"passthrough" => user.id,
"passthrough" => "user:#{user.id};team:#{team.id}",
"product" => @v4_growth_200k_yearly_plan_id,
"success" => Routes.billing_path(PlausibleWeb.Endpoint, :upgrade_success),
"theme" => "none"

View File

@ -35,14 +35,11 @@ defmodule Plausible.TestUtils do
end
def create_user(_) do
{:ok, user: Factory.insert(:user)}
{:ok, user: Plausible.Teams.Test.new_user()}
end
def create_site(%{user: user}) do
site =
Factory.insert(:site,
members: [user]
)
site = Plausible.Teams.Test.new_site(owner: user)
{:ok, site: site}
end