fix tests

This commit is contained in:
shibao 2022-02-25 22:17:30 -05:00
parent 023bd5f0ed
commit e57e3f10e8
11 changed files with 143 additions and 14 deletions

View File

@ -4,8 +4,8 @@ defmodule LokalWeb.InviteLive.FormComponent do
"""
use LokalWeb, :live_component
alias Lokal.{Accounts.User, Invites, Invites.Invite}
alias Ecto.Changeset
alias Lokal.{Accounts.User, Invites, Invites.Invite}
alias Phoenix.LiveView.Socket
@impl true

View File

@ -12,6 +12,7 @@ defmodule Lokal.MixProject do
aliases: aliases(),
deps: deps(),
dialyzer: [plt_add_apps: [:ex_unit]],
consolidate_protocols: Mix.env() not in [:dev, :test],
# ExDoc
name: "Lokal",
source_url: "https://gitea.bubbletea.dev/shibao/lokal",

View File

@ -72,3 +72,23 @@ msgstr ""
#: lib/lokal_web/templates/user_reset_password/new.html.heex:16
msgid "Send instructions to reset password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:32
msgid "Copy to clipboard"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:16
msgid "Create Invite"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:11
msgid "Invite someone new!"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.html.heex:28
msgid "Save"
msgstr ""

View File

@ -38,6 +38,8 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/components/topbar.ex:58
#: lib/lokal_web/live/invite_live/index.ex:43
#: lib/lokal_web/live/invite_live/index.html.heex:3
msgid "Invites"
msgstr ""
@ -101,3 +103,53 @@ msgstr ""
#: lib/lokal_web/live/page_live.ex:13
msgid "Home"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:89
msgid "Admins"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:58
msgid "Disable"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:35
msgid "Edit Invite"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:62
msgid "Enable"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.html.heex:20
msgid "Name"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:39
msgid "New Invite"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:8
msgid "No invites 😔"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:78
msgid "Set Unlimited"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:118
msgid "Users"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.html.heex:24
msgid "Uses left"
msgstr ""

View File

@ -193,3 +193,8 @@ msgstr ""
#: lib/lokal/accounts/user.ex:82
msgid "must have the @ sign and no spaces"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:20
msgid "You are not authorized to view this page"
msgstr ""

View File

@ -69,3 +69,60 @@ msgstr ""
#: lib/lokal_web/controllers/user_settings_controller.ex:78
msgid "Your account has been deleted"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.ex:59
msgid "%{name} created successfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:55
#: lib/lokal_web/live/invite_live/index.ex:135
msgid "%{name} deleted succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:111
msgid "%{name} disabled succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:89
msgid "%{name} enabled succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:69
msgid "%{name} updated succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.ex:41
msgid "%{name} updated successfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:101
#: lib/lokal_web/live/invite_live/index.html.heex:130
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:48
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:73
msgid "Are you sure you want to make %{name} unlimited?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:123
msgid "Copied to clipboard"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.html.heex:30
msgid "Saving..."
msgstr ""

View File

@ -4,9 +4,9 @@ defmodule Lokal.AccountsTest do
"""
use Lokal.DataCase
alias Ecto.Changeset
alias Lokal.Accounts
alias Lokal.Accounts.{User, UserToken}
alias Ecto.Changeset
@moduletag :accounts_test

View File

@ -4,8 +4,8 @@ defmodule Lokal.InvitesTest do
"""
use Lokal.DataCase
alias Lokal.{Invites, Invites.Invite}
alias Ecto.Changeset
alias Lokal.{Invites, Invites.Invite}
@moduletag :invites_test

View File

@ -37,12 +37,6 @@ defmodule LokalWeb.UserRegistrationControllerTest do
}
assert redirected_to(conn) =~ "/"
# Now do a logged in request and assert on the menu
conn = get(conn, "/")
response = html_response(conn, 200)
# user's email is recorded as admin
assert response =~ email
end
test "render errors for invalid data", %{conn: conn} do

View File

@ -17,8 +17,8 @@ defmodule LokalWeb.ConnCase do
use ExUnit.CaseTemplate
import Lokal.Fixtures
alias Lokal.{Accounts, Accounts.User, Repo}
alias Ecto.Adapters.SQL.Sandbox
alias Lokal.{Accounts, Accounts.User, Repo}
using do
quote do

View File

@ -8,8 +8,8 @@ defmodule Lokal.Fixtures do
def unique_user_email, do: "user#{System.unique_integer()}@example.com"
def valid_user_password, do: "hello world!"
@spec user_fixture() :: Accounts.User.t()
@spec user_fixture(attrs :: map()) :: Accounts.User.t()
@spec user_fixture() :: User.t()
@spec user_fixture(attrs :: map()) :: User.t()
def user_fixture(attrs \\ %{}) do
attrs
|> Enum.into(%{
@ -20,8 +20,8 @@ defmodule Lokal.Fixtures do
|> unwrap_ok_tuple()
end
@spec admin_fixture() :: Accounts.User.t()
@spec admin_fixture(attrs :: map()) :: Accounts.User.t()
@spec admin_fixture() :: User.t()
@spec admin_fixture(attrs :: map()) :: User.t()
def admin_fixture(attrs \\ %{}) do
attrs
|> Enum.into(%{