mirror of
https://github.com/plausible/analytics.git
synced 2024-11-22 02:27:57 +03:00
Modify test utils to use teams test factories
This commit is contained in:
parent
98bc3e7554
commit
5eb8754782
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user