mirror of
https://github.com/plausible/analytics.git
synced 2024-12-22 17:11:36 +03:00
Update plans_v4.json with new plans IDs (#3436)
* Update plans_v4.json with new plans IDs * Fix failing tests --------- Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
This commit is contained in:
parent
7674c94ace
commit
3b0322670b
@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":10000,
|
"monthly_pageview_limit":10000,
|
||||||
"monthly_product_id":"change-me-749342",
|
"monthly_product_id":"857097",
|
||||||
"yearly_product_id":"change-me-749343",
|
"yearly_product_id":"857079",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -11,8 +11,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":100000,
|
"monthly_pageview_limit":100000,
|
||||||
"monthly_product_id":"change-me-749344",
|
"monthly_product_id":"857098",
|
||||||
"yearly_product_id":"change-me-749345",
|
"yearly_product_id":"857080",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -20,8 +20,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":200000,
|
"monthly_pageview_limit":200000,
|
||||||
"monthly_product_id":"change-me-749346",
|
"monthly_product_id":"857099",
|
||||||
"yearly_product_id":"change-me-749347",
|
"yearly_product_id":"857081",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -29,8 +29,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":500000,
|
"monthly_pageview_limit":500000,
|
||||||
"monthly_product_id":"change-me-749348",
|
"monthly_product_id":"857100",
|
||||||
"yearly_product_id":"change-me-749349",
|
"yearly_product_id":"857082",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -38,8 +38,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":1000000,
|
"monthly_pageview_limit":1000000,
|
||||||
"monthly_product_id":"change-me-749350",
|
"monthly_product_id":"857101",
|
||||||
"yearly_product_id":"change-me-749352",
|
"yearly_product_id":"857083",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -47,8 +47,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":2000000,
|
"monthly_pageview_limit":2000000,
|
||||||
"monthly_product_id":"change-me-749353",
|
"monthly_product_id":"857102",
|
||||||
"yearly_product_id":"change-me-749355",
|
"yearly_product_id":"857084",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -56,8 +56,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":5000000,
|
"monthly_pageview_limit":5000000,
|
||||||
"monthly_product_id":"change-me-749356",
|
"monthly_product_id":"857103",
|
||||||
"yearly_product_id":"change-me-749357",
|
"yearly_product_id":"857085",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -65,8 +65,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"growth",
|
"kind":"growth",
|
||||||
"monthly_pageview_limit":10000000,
|
"monthly_pageview_limit":10000000,
|
||||||
"monthly_product_id":"change-me-749358",
|
"monthly_product_id":"857104",
|
||||||
"yearly_product_id":"change-me-749359",
|
"yearly_product_id":"857086",
|
||||||
"site_limit":10,
|
"site_limit":10,
|
||||||
"team_member_limit":5,
|
"team_member_limit":5,
|
||||||
"features":["goals"]
|
"features":["goals"]
|
||||||
@ -74,8 +74,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":10000,
|
"monthly_pageview_limit":10000,
|
||||||
"monthly_product_id":"change-me-b749342",
|
"monthly_product_id":"857105",
|
||||||
"yearly_product_id":"change-me-b749343",
|
"yearly_product_id":"857087",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
@ -83,8 +83,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":100000,
|
"monthly_pageview_limit":100000,
|
||||||
"monthly_product_id":"change-me-b749344",
|
"monthly_product_id":"857106",
|
||||||
"yearly_product_id":"change-me-b749345",
|
"yearly_product_id":"857088",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
@ -92,8 +92,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":200000,
|
"monthly_pageview_limit":200000,
|
||||||
"monthly_product_id":"change-me-b749346",
|
"monthly_product_id":"857107",
|
||||||
"yearly_product_id":"change-me-b749347",
|
"yearly_product_id":"857089",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
@ -101,8 +101,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":500000,
|
"monthly_pageview_limit":500000,
|
||||||
"monthly_product_id":"change-me-b749348",
|
"monthly_product_id":"857108",
|
||||||
"yearly_product_id":"change-me-b749349",
|
"yearly_product_id":"857090",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
@ -110,8 +110,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":1000000,
|
"monthly_pageview_limit":1000000,
|
||||||
"monthly_product_id":"change-me-b749350",
|
"monthly_product_id":"857109",
|
||||||
"yearly_product_id":"change-me-b749352",
|
"yearly_product_id":"857091",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
@ -119,8 +119,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":2000000,
|
"monthly_pageview_limit":2000000,
|
||||||
"monthly_product_id":"change-me-b749353",
|
"monthly_product_id":"857110",
|
||||||
"yearly_product_id":"change-me-b749355",
|
"yearly_product_id":"857092",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
@ -128,8 +128,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":5000000,
|
"monthly_pageview_limit":5000000,
|
||||||
"monthly_product_id":"change-me-b749356",
|
"monthly_product_id":"857111",
|
||||||
"yearly_product_id":"change-me-b749357",
|
"yearly_product_id":"857093",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
@ -137,8 +137,8 @@
|
|||||||
{
|
{
|
||||||
"kind":"business",
|
"kind":"business",
|
||||||
"monthly_pageview_limit":10000000,
|
"monthly_pageview_limit":10000000,
|
||||||
"monthly_product_id":"change-me-b749358",
|
"monthly_product_id":"857112",
|
||||||
"yearly_product_id":"change-me-b749359",
|
"yearly_product_id":"857094",
|
||||||
"site_limit":50,
|
"site_limit":50,
|
||||||
"team_member_limit":50,
|
"team_member_limit":50,
|
||||||
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
"features":["goals","props","revenue_goals","funnels","stats_api"]
|
||||||
|
@ -2,8 +2,6 @@ defmodule Plausible.AuthTest do
|
|||||||
use Plausible.DataCase, async: true
|
use Plausible.DataCase, async: true
|
||||||
alias Plausible.Auth
|
alias Plausible.Auth
|
||||||
|
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
|
|
||||||
describe "user_completed_setup?" do
|
describe "user_completed_setup?" do
|
||||||
test "is false if user does not have any sites" do
|
test "is false if user does not have any sites" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
@ -72,7 +70,7 @@ defmodule Plausible.AuthTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "returns error when user is on a growth plan" do
|
test "returns error when user is on a growth plan" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
||||||
assert {:error, :upgrade_required} =
|
assert {:error, :upgrade_required} =
|
||||||
Auth.create_api_key(user, "my new key", Ecto.UUID.generate())
|
Auth.create_api_key(user, "my new key", Ecto.UUID.generate())
|
||||||
|
@ -2,8 +2,6 @@ defmodule Plausible.Billing.FeatureTest do
|
|||||||
use Plausible.DataCase
|
use Plausible.DataCase
|
||||||
|
|
||||||
@v1_plan_id "558018"
|
@v1_plan_id "558018"
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
@v4_business_plan_id "change-me-b749342"
|
|
||||||
|
|
||||||
for mod <- [Plausible.Billing.Feature.Funnels, Plausible.Billing.Feature.RevenueGoals] do
|
for mod <- [Plausible.Billing.Feature.Funnels, Plausible.Billing.Feature.RevenueGoals] do
|
||||||
test "#{mod}.check_availability/1 returns :ok when site owner is on a enterprise plan" do
|
test "#{mod}.check_availability/1 returns :ok when site owner is on a enterprise plan" do
|
||||||
@ -17,14 +15,13 @@ defmodule Plausible.Billing.FeatureTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "#{mod}.check_availability/1 returns :ok when site owner is on a business plan" do
|
test "#{mod}.check_availability/1 returns :ok when site owner is on a business plan" do
|
||||||
user =
|
user = insert(:user, subscription: build(:business_subscription))
|
||||||
insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_business_plan_id))
|
|
||||||
|
|
||||||
assert :ok == unquote(mod).check_availability(user)
|
assert :ok == unquote(mod).check_availability(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "#{mod}.check_availability/1 returns error when site owner is on a growth plan" do
|
test "#{mod}.check_availability/1 returns error when site owner is on a growth plan" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
assert {:error, :upgrade_required} == unquote(mod).check_availability(user)
|
assert {:error, :upgrade_required} == unquote(mod).check_availability(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -35,7 +32,7 @@ defmodule Plausible.Billing.FeatureTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "Plausible.Billing.Feature.StatsAPI.check_availability/2 returns :ok when user is on a business plan" do
|
test "Plausible.Billing.Feature.StatsAPI.check_availability/2 returns :ok when user is on a business plan" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_business_plan_id))
|
user = insert(:user, subscription: build(:business_subscription))
|
||||||
assert :ok == Plausible.Billing.Feature.StatsAPI.check_availability(user)
|
assert :ok == Plausible.Billing.Feature.StatsAPI.check_availability(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,7 +57,7 @@ defmodule Plausible.Billing.FeatureTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "Plausible.Billing.Feature.StatsAPI.check_availability/2 returns error when user is on a growth plan" do
|
test "Plausible.Billing.Feature.StatsAPI.check_availability/2 returns error when user is on a growth plan" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
||||||
assert {:error, :upgrade_required} ==
|
assert {:error, :upgrade_required} ==
|
||||||
Plausible.Billing.Feature.StatsAPI.check_availability(user)
|
Plausible.Billing.Feature.StatsAPI.check_availability(user)
|
||||||
@ -73,8 +70,8 @@ defmodule Plausible.Billing.FeatureTest do
|
|||||||
|
|
||||||
test "Plausible.Billing.Feature.Goals.check_availability/2 always returns :ok" do
|
test "Plausible.Billing.Feature.Goals.check_availability/2 always returns :ok" do
|
||||||
u1 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v1_plan_id))
|
u1 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v1_plan_id))
|
||||||
u2 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
u2 = insert(:user, subscription: build(:growth_subscription))
|
||||||
u3 = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_business_plan_id))
|
u3 = insert(:user, subscription: build(:business_subscription))
|
||||||
|
|
||||||
u4 =
|
u4 =
|
||||||
insert(:user,
|
insert(:user,
|
||||||
@ -113,7 +110,7 @@ defmodule Plausible.Billing.FeatureTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "#{mod}.toggle/2 errors when site owner does not have access to the feature" do
|
test "#{mod}.toggle/2 errors when site owner does not have access to the feature" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
site = insert(:site, [{:members, [user]}, {unquote(property), false}])
|
site = insert(:site, [{:members, [user]}, {unquote(property), false}])
|
||||||
{:error, :upgrade_required} = unquote(mod).toggle(site)
|
{:error, :upgrade_required} = unquote(mod).toggle(site)
|
||||||
refute unquote(mod).enabled?(site)
|
refute unquote(mod).enabled?(site)
|
||||||
@ -134,7 +131,7 @@ defmodule Plausible.Billing.FeatureTest do
|
|||||||
|
|
||||||
for mod <- [Plausible.Billing.Feature.Funnels, Plausible.Billing.Feature.Props] do
|
for mod <- [Plausible.Billing.Feature.Funnels, Plausible.Billing.Feature.Props] do
|
||||||
test "#{mod}.enabled?/1 returns false when user does not have access to the feature even when enabled" do
|
test "#{mod}.enabled?/1 returns false when user does not have access to the feature even when enabled" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
site = insert(:site, [{:members, [user]}, {unquote(mod).toggle_field(), true}])
|
site = insert(:site, [{:members, [user]}, {unquote(mod).toggle_field(), true}])
|
||||||
refute unquote(mod).enabled?(site)
|
refute unquote(mod).enabled?(site)
|
||||||
end
|
end
|
||||||
|
@ -4,8 +4,8 @@ defmodule Plausible.Billing.PlansTest do
|
|||||||
|
|
||||||
@v1_plan_id "558018"
|
@v1_plan_id "558018"
|
||||||
@v2_plan_id "654177"
|
@v2_plan_id "654177"
|
||||||
@v4_plan_id "change-me-749342"
|
@v4_plan_id "857097"
|
||||||
@v4_business_plan_id "change-me-b749342"
|
@v4_business_plan_id "857105"
|
||||||
|
|
||||||
describe "getting subscription plans for user" do
|
describe "getting subscription plans for user" do
|
||||||
test "growth_plans_for/1 shows v1 pricing for users who are already on v1 pricing" do
|
test "growth_plans_for/1 shows v1 pricing for users who are already on v1 pricing" do
|
||||||
@ -177,22 +177,22 @@ defmodule Plausible.Billing.PlansTest do
|
|||||||
"749355",
|
"749355",
|
||||||
"749357",
|
"749357",
|
||||||
"749359",
|
"749359",
|
||||||
"change-me-749343",
|
"857079",
|
||||||
"change-me-749345",
|
"857080",
|
||||||
"change-me-749347",
|
"857081",
|
||||||
"change-me-749349",
|
"857082",
|
||||||
"change-me-749352",
|
"857083",
|
||||||
"change-me-749355",
|
"857084",
|
||||||
"change-me-749357",
|
"857085",
|
||||||
"change-me-749359",
|
"857086",
|
||||||
"change-me-b749343",
|
"857087",
|
||||||
"change-me-b749345",
|
"857088",
|
||||||
"change-me-b749347",
|
"857089",
|
||||||
"change-me-b749349",
|
"857090",
|
||||||
"change-me-b749352",
|
"857091",
|
||||||
"change-me-b749355",
|
"857092",
|
||||||
"change-me-b749357",
|
"857093",
|
||||||
"change-me-b749359"
|
"857094"
|
||||||
] == Plans.yearly_product_ids()
|
] == Plans.yearly_product_ids()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,8 +6,6 @@ defmodule Plausible.Billing.QuotaTest do
|
|||||||
@v1_plan_id "558018"
|
@v1_plan_id "558018"
|
||||||
@v2_plan_id "654177"
|
@v2_plan_id "654177"
|
||||||
@v3_plan_id "749342"
|
@v3_plan_id "749342"
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
@v4_business_plan_id "change-me-b749342"
|
|
||||||
|
|
||||||
describe "site_limit/1" do
|
describe "site_limit/1" do
|
||||||
test "returns 50 when user is on an old plan" do
|
test "returns 50 when user is on an old plan" do
|
||||||
@ -354,11 +352,9 @@ defmodule Plausible.Billing.QuotaTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "reads from json file when the user is on a v4 plan" do
|
test "reads from json file when the user is on a v4 plan" do
|
||||||
user_on_growth =
|
user_on_growth = insert(:user, subscription: build(:growth_subscription))
|
||||||
insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
|
||||||
|
|
||||||
user_on_business =
|
user_on_business = insert(:user, subscription: build(:business_subscription))
|
||||||
insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_business_plan_id))
|
|
||||||
|
|
||||||
assert 5 == Quota.team_member_limit(user_on_growth)
|
assert 5 == Quota.team_member_limit(user_on_growth)
|
||||||
assert 50 == Quota.team_member_limit(user_on_business)
|
assert 50 == Quota.team_member_limit(user_on_business)
|
||||||
|
@ -2,8 +2,6 @@ defmodule Plausible.GoalsTest do
|
|||||||
use Plausible.DataCase
|
use Plausible.DataCase
|
||||||
alias Plausible.Goals
|
alias Plausible.Goals
|
||||||
|
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
|
|
||||||
test "create/2 creates goals and trims input" do
|
test "create/2 creates goals and trims input" do
|
||||||
site = insert(:site)
|
site = insert(:site)
|
||||||
{:ok, goal} = Goals.create(site, %{"page_path" => "/foo bar "})
|
{:ok, goal} = Goals.create(site, %{"page_path" => "/foo bar "})
|
||||||
@ -73,7 +71,7 @@ defmodule Plausible.GoalsTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "create/2 returns error when site does not have access to revenue goals" do
|
test "create/2 returns error when site does not have access to revenue goals" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
site = insert(:site, members: [user])
|
site = insert(:site, members: [user])
|
||||||
|
|
||||||
{:error, :upgrade_required} =
|
{:error, :upgrade_required} =
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
defmodule Plausible.PropsTest do
|
defmodule Plausible.PropsTest do
|
||||||
use Plausible.DataCase
|
use Plausible.DataCase
|
||||||
|
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
|
|
||||||
test "allow/2 returns error when user plan does not include props" do
|
test "allow/2 returns error when user plan does not include props" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
site = insert(:site, members: [user])
|
site = insert(:site, members: [user])
|
||||||
|
|
||||||
assert {:error, :upgrade_required} = Plausible.Props.allow(site, "my-prop-1")
|
assert {:error, :upgrade_required} = Plausible.Props.allow(site, "my-prop-1")
|
||||||
@ -94,7 +92,7 @@ defmodule Plausible.PropsTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "allow_existing_props/2 returns error when user plan does not include props" do
|
test "allow_existing_props/2 returns error when user plan does not include props" do
|
||||||
user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
user = insert(:user, subscription: build(:growth_subscription))
|
||||||
site = insert(:site, members: [user])
|
site = insert(:site, members: [user])
|
||||||
|
|
||||||
populate_stats(site, [
|
populate_stats(site, [
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
defmodule Plausible.Stats.QueryTest do
|
defmodule Plausible.Stats.QueryTest do
|
||||||
use Plausible.DataCase, async: true
|
use Plausible.DataCase, async: true
|
||||||
alias Plausible.Stats.Query
|
alias Plausible.Stats.Query
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
@v4_business_plan_id "change-me-b749342"
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
@ -186,7 +184,7 @@ defmodule Plausible.Stats.QueryTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "allows prop filters when site owner is on a business plan", %{site: site, user: user} do
|
test "allows prop filters when site owner is on a business plan", %{site: site, user: user} do
|
||||||
insert(:subscription, user: user, paddle_plan_id: @v4_business_plan_id)
|
insert(:business_subscription, user: user)
|
||||||
filters = Jason.encode!(%{"props" => %{"author" => "!John Doe"}})
|
filters = Jason.encode!(%{"props" => %{"author" => "!John Doe"}})
|
||||||
query = Query.from(site, %{"period" => "6mo", "filters" => filters})
|
query = Query.from(site, %{"period" => "6mo", "filters" => filters})
|
||||||
|
|
||||||
@ -194,7 +192,7 @@ defmodule Plausible.Stats.QueryTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "drops prop filter when site owner is on a growth plan", %{site: site, user: user} do
|
test "drops prop filter when site owner is on a growth plan", %{site: site, user: user} do
|
||||||
insert(:subscription, user: user, paddle_plan_id: @v4_growth_plan_id)
|
insert(:growth_subscription, user: user)
|
||||||
filters = Jason.encode!(%{"props" => %{"author" => "!John Doe"}})
|
filters = Jason.encode!(%{"props" => %{"author" => "!John Doe"}})
|
||||||
query = Query.from(site, %{"period" => "6mo", "filters" => filters})
|
query = Query.from(site, %{"period" => "6mo", "filters" => filters})
|
||||||
|
|
||||||
|
@ -3,9 +3,6 @@ defmodule PlausibleWeb.Components.BillingTest do
|
|||||||
import Phoenix.LiveViewTest
|
import Phoenix.LiveViewTest
|
||||||
alias PlausibleWeb.Components.Billing
|
alias PlausibleWeb.Components.Billing
|
||||||
|
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
@v4_business_plan_id "change-me-b749342"
|
|
||||||
|
|
||||||
test "premium_feature_notice/1 renders a message when user is on trial" do
|
test "premium_feature_notice/1 renders a message when user is on trial" do
|
||||||
me = insert(:user)
|
me = insert(:user)
|
||||||
|
|
||||||
@ -18,7 +15,7 @@ defmodule PlausibleWeb.Components.BillingTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "premium_feature_notice/1 renders an upgrade link when user is the site owner and does not have access to the feature" do
|
test "premium_feature_notice/1 renders an upgrade link when user is the site owner and does not have access to the feature" do
|
||||||
me = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
me = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
||||||
rendered =
|
rendered =
|
||||||
render_component(&Billing.premium_feature_notice/1,
|
render_component(&Billing.premium_feature_notice/1,
|
||||||
@ -34,7 +31,7 @@ defmodule PlausibleWeb.Components.BillingTest do
|
|||||||
|
|
||||||
test "premium_feature_notice/1 does not render an upgrade link when user is not the site owner" do
|
test "premium_feature_notice/1 does not render an upgrade link when user is not the site owner" do
|
||||||
me = insert(:user)
|
me = insert(:user)
|
||||||
owner = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_growth_plan_id))
|
owner = insert(:user, subscription: build(:growth_subscription))
|
||||||
|
|
||||||
rendered =
|
rendered =
|
||||||
render_component(&Billing.premium_feature_notice/1,
|
render_component(&Billing.premium_feature_notice/1,
|
||||||
@ -50,7 +47,7 @@ defmodule PlausibleWeb.Components.BillingTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "premium_feature_notice/1 does not render a notice when the user has access to the feature" do
|
test "premium_feature_notice/1 does not render a notice when the user has access to the feature" do
|
||||||
me = insert(:user, subscription: build(:subscription, paddle_plan_id: @v4_business_plan_id))
|
me = insert(:user, subscription: build(:business_subscription))
|
||||||
|
|
||||||
rendered =
|
rendered =
|
||||||
render_component(&Billing.premium_feature_notice/1,
|
render_component(&Billing.premium_feature_notice/1,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
defmodule PlausibleWeb.Api.ExternalStatsController.AuthTest do
|
defmodule PlausibleWeb.Api.ExternalStatsController.AuthTest do
|
||||||
use PlausibleWeb.ConnCase
|
use PlausibleWeb.ConnCase
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
|
|
||||||
setup [:create_user, :create_api_key]
|
setup [:create_user, :create_api_key]
|
||||||
|
|
||||||
@ -155,7 +154,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.AuthTest do
|
|||||||
user: user,
|
user: user,
|
||||||
api_key: api_key
|
api_key: api_key
|
||||||
} do
|
} do
|
||||||
insert(:subscription, user: user, paddle_plan_id: @v4_growth_plan_id)
|
insert(:growth_subscription, user: user)
|
||||||
site = insert(:site, members: [user])
|
site = insert(:site, members: [user])
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
defmodule PlausibleWeb.Api.StatsController.CustomPropBreakdownTest do
|
defmodule PlausibleWeb.Api.StatsController.CustomPropBreakdownTest do
|
||||||
use PlausibleWeb.ConnCase
|
use PlausibleWeb.ConnCase
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
|
|
||||||
describe "GET /api/stats/:domain/custom-prop-values/:prop_key" do
|
describe "GET /api/stats/:domain/custom-prop-values/:prop_key" do
|
||||||
setup [:create_user, :log_in, :create_new_site, :add_imported_data]
|
setup [:create_user, :log_in, :create_new_site, :add_imported_data]
|
||||||
@ -180,7 +179,7 @@ defmodule PlausibleWeb.Api.StatsController.CustomPropBreakdownTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "errors when site owner is on a growth plan", %{conn: conn, site: site, user: user} do
|
test "errors when site owner is on a growth plan", %{conn: conn, site: site, user: user} do
|
||||||
insert(:subscription, user: user, paddle_plan_id: @v4_growth_plan_id)
|
insert(:growth_subscription, user: user)
|
||||||
|
|
||||||
conn = get(conn, "/api/stats/#{site.domain}/custom-prop-values/prop?period=day")
|
conn = get(conn, "/api/stats/#{site.domain}/custom-prop-values/prop?period=day")
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ defmodule PlausibleWeb.Api.StatsController.FunnelsTest do
|
|||||||
|
|
||||||
@user_id 123
|
@user_id 123
|
||||||
@other_user_id 456
|
@other_user_id 456
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
|
|
||||||
@build_funnel_with [
|
@build_funnel_with [
|
||||||
{"page_path", "/blog/announcement"},
|
{"page_path", "/blog/announcement"},
|
||||||
@ -226,7 +225,7 @@ defmodule PlausibleWeb.Api.StatsController.FunnelsTest do
|
|||||||
user: user,
|
user: user,
|
||||||
site: site
|
site: site
|
||||||
} do
|
} do
|
||||||
insert(:subscription, user: user, paddle_plan_id: @v4_growth_plan_id)
|
insert(:growth_subscription, user: user)
|
||||||
{:ok, funnel} = setup_funnel(site, @build_funnel_with)
|
{:ok, funnel} = setup_funnel(site, @build_funnel_with)
|
||||||
|
|
||||||
resp =
|
resp =
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
|
defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
|
||||||
use PlausibleWeb.ConnCase
|
use PlausibleWeb.ConnCase
|
||||||
|
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
@user_id 123
|
@user_id 123
|
||||||
|
|
||||||
describe "GET /api/stats/top-stats - default" do
|
describe "GET /api/stats/top-stats - default" do
|
||||||
@ -829,7 +828,7 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
|
|||||||
|
|
||||||
test "does not return average and total when site owner is on a growth plan",
|
test "does not return average and total when site owner is on a growth plan",
|
||||||
%{conn: conn, site: site, user: user} do
|
%{conn: conn, site: site, user: user} do
|
||||||
insert(:subscription, user: user, paddle_plan_id: @v4_growth_plan_id)
|
insert(:growth_subscription, user: user)
|
||||||
insert(:goal, site: site, event_name: "Payment", currency: "USD")
|
insert(:goal, site: site, event_name: "Payment", currency: "USD")
|
||||||
|
|
||||||
populate_stats(site, [
|
populate_stats(site, [
|
||||||
|
@ -2,7 +2,6 @@ defmodule PlausibleWeb.StatsControllerTest do
|
|||||||
use PlausibleWeb.ConnCase, async: false
|
use PlausibleWeb.ConnCase, async: false
|
||||||
use Plausible.Repo
|
use Plausible.Repo
|
||||||
import Plausible.Test.Support.HTML
|
import Plausible.Test.Support.HTML
|
||||||
@v4_growth_plan_id "change-me-749342"
|
|
||||||
|
|
||||||
describe "GET /:website - anonymous user" do
|
describe "GET /:website - anonymous user" do
|
||||||
test "public site - shows site stats", %{conn: conn} do
|
test "public site - shows site stats", %{conn: conn} do
|
||||||
@ -160,7 +159,7 @@ defmodule PlausibleWeb.StatsControllerTest do
|
|||||||
site: site,
|
site: site,
|
||||||
user: user
|
user: user
|
||||||
} do
|
} do
|
||||||
insert(:subscription, user: user, paddle_plan_id: @v4_growth_plan_id)
|
insert(:growth_subscription, user: user)
|
||||||
response = conn |> get("/" <> site.domain <> "/export") |> response(200)
|
response = conn |> get("/" <> site.domain <> "/export") |> response(200)
|
||||||
|
|
||||||
{:ok, zip} = :zip.unzip(response, [:memory])
|
{:ok, zip} = :zip.unzip(response, [:memory])
|
||||||
|
@ -6,8 +6,8 @@ defmodule PlausibleWeb.Live.ChoosePlanTest do
|
|||||||
alias Plausible.{Repo, Billing.Subscription}
|
alias Plausible.{Repo, Billing.Subscription}
|
||||||
|
|
||||||
@v1_10k_yearly_plan_id "572810"
|
@v1_10k_yearly_plan_id "572810"
|
||||||
@v4_growth_200k_yearly_plan_id "change-me-749347"
|
@v4_growth_200k_yearly_plan_id "857081"
|
||||||
@v4_business_5m_monthly_plan_id "change-me-b749356"
|
@v4_business_5m_monthly_plan_id "857111"
|
||||||
|
|
||||||
@monthly_interval_button ~s/label[phx-click="set_interval"][phx-value-interval="monthly"]/
|
@monthly_interval_button ~s/label[phx-click="set_interval"][phx-value-interval="monthly"]/
|
||||||
@yearly_interval_button ~s/label[phx-click="set_interval"][phx-value-interval="yearly"]/
|
@yearly_interval_button ~s/label[phx-click="set_interval"][phx-value-interval="yearly"]/
|
||||||
|
@ -107,6 +107,14 @@ defmodule Plausible.Factory do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def growth_subscription_factory do
|
||||||
|
build(:subscription, paddle_plan_id: "857097")
|
||||||
|
end
|
||||||
|
|
||||||
|
def business_subscription_factory do
|
||||||
|
build(:subscription, paddle_plan_id: "857087")
|
||||||
|
end
|
||||||
|
|
||||||
def enterprise_plan_factory do
|
def enterprise_plan_factory do
|
||||||
%Plausible.Billing.EnterprisePlan{
|
%Plausible.Billing.EnterprisePlan{
|
||||||
paddle_plan_id: sequence(:paddle_plan_id, &"plan-#{&1}"),
|
paddle_plan_id: sequence(:paddle_plan_id, &"plan-#{&1}"),
|
||||||
|
Loading…
Reference in New Issue
Block a user