This commit is contained in:
Liam P. White 2019-08-28 18:50:36 -04:00
parent a052b0e079
commit 5085d3c9d1
18 changed files with 137 additions and 48 deletions

View file

@ -32,8 +32,7 @@ config :philomena, PhilomenaWeb.Endpoint,
render_errors: [view: PhilomenaWeb.ErrorView, accepts: ~w(html json)], render_errors: [view: PhilomenaWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: Philomena.PubSub, adapter: Phoenix.PubSub.PG2] pubsub: [name: Philomena.PubSub, adapter: Phoenix.PubSub.PG2]
config :philomena, :generators, config :philomena, :generators, migration: false
migration: false
config :phoenix, :template_engines, config :phoenix, :template_engines,
slim: PhoenixSlime.Engine, slim: PhoenixSlime.Engine,

View file

@ -7,7 +7,7 @@ defmodule Philomena.Conversations.Message do
belongs_to :from, Philomena.Users.User belongs_to :from, Philomena.Users.User
field :body, :string field :body, :string
timestamps(inserted_at: :created_at) timestamps(inserted_at: :created_at)
end end

View file

@ -6,7 +6,7 @@ defmodule Philomena.DnpEntries.DnpEntry do
belongs_to :requesting_user, Philomena.Users.User belongs_to :requesting_user, Philomena.Users.User
belongs_to :modifying_user, Philomena.Users.User belongs_to :modifying_user, Philomena.Users.User
belongs_to :tag, Philomena.Tags.Tag belongs_to :tag, Philomena.Tags.Tag
field :aasm_state, :string, default: "requested" field :aasm_state, :string, default: "requested"
field :dnp_type, :string field :dnp_type, :string
field :conditions, :string field :conditions, :string

View file

@ -3,7 +3,6 @@ defmodule Philomena.Forums.PollVote do
import Ecto.Changeset import Ecto.Changeset
schema "poll_votes" do schema "poll_votes" do
timestamps() timestamps()
end end

View file

@ -6,7 +6,7 @@ defmodule Philomena.Images.Intensities do
schema "image_intensities" do schema "image_intensities" do
belongs_to :image, Philomena.Images.Image, primary_key: true belongs_to :image, Philomena.Images.Image, primary_key: true
field :nw, :float field :nw, :float
field :ne, :float field :ne, :float
field :sw, :float field :sw, :float

View file

@ -96,7 +96,9 @@ defmodule Philomena.BadgesTest do
test "update_badge_award/2 with valid data updates the badge_award" do test "update_badge_award/2 with valid data updates the badge_award" do
badge_award = badge_award_fixture() badge_award = badge_award_fixture()
assert {:ok, %BadgeAward{} = badge_award} = Badges.update_badge_award(badge_award, @update_attrs)
assert {:ok, %BadgeAward{} = badge_award} =
Badges.update_badge_award(badge_award, @update_attrs)
end end
test "update_badge_award/2 with invalid data returns error changeset" do test "update_badge_award/2 with invalid data returns error changeset" do

View file

@ -39,7 +39,9 @@ defmodule Philomena.BansTest do
test "update_fingerprint/2 with valid data updates the fingerprint" do test "update_fingerprint/2 with valid data updates the fingerprint" do
fingerprint = fingerprint_fixture() fingerprint = fingerprint_fixture()
assert {:ok, %Fingerprint{} = fingerprint} = Bans.update_fingerprint(fingerprint, @update_attrs)
assert {:ok, %Fingerprint{} = fingerprint} =
Bans.update_fingerprint(fingerprint, @update_attrs)
end end
test "update_fingerprint/2 with invalid data returns error changeset" do test "update_fingerprint/2 with invalid data returns error changeset" do

View file

@ -39,12 +39,17 @@ defmodule Philomena.CommissionsTest do
test "update_commission/2 with valid data updates the commission" do test "update_commission/2 with valid data updates the commission" do
commission = commission_fixture() commission = commission_fixture()
assert {:ok, %Commission{} = commission} = Commissions.update_commission(commission, @update_attrs)
assert {:ok, %Commission{} = commission} =
Commissions.update_commission(commission, @update_attrs)
end end
test "update_commission/2 with invalid data returns error changeset" do test "update_commission/2 with invalid data returns error changeset" do
commission = commission_fixture() commission = commission_fixture()
assert {:error, %Ecto.Changeset{}} = Commissions.update_commission(commission, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Commissions.update_commission(commission, @invalid_attrs)
assert commission == Commissions.get_commission!(commission.id) assert commission == Commissions.get_commission!(commission.id)
end end

View file

@ -30,7 +30,8 @@ defmodule Philomena.ConversationsTest do
end end
test "create_conversation/1 with valid data creates a conversation" do test "create_conversation/1 with valid data creates a conversation" do
assert {:ok, %Conversation{} = conversation} = Conversations.create_conversation(@valid_attrs) assert {:ok, %Conversation{} = conversation} =
Conversations.create_conversation(@valid_attrs)
end end
test "create_conversation/1 with invalid data returns error changeset" do test "create_conversation/1 with invalid data returns error changeset" do
@ -39,12 +40,17 @@ defmodule Philomena.ConversationsTest do
test "update_conversation/2 with valid data updates the conversation" do test "update_conversation/2 with valid data updates the conversation" do
conversation = conversation_fixture() conversation = conversation_fixture()
assert {:ok, %Conversation{} = conversation} = Conversations.update_conversation(conversation, @update_attrs)
assert {:ok, %Conversation{} = conversation} =
Conversations.update_conversation(conversation, @update_attrs)
end end
test "update_conversation/2 with invalid data returns error changeset" do test "update_conversation/2 with invalid data returns error changeset" do
conversation = conversation_fixture() conversation = conversation_fixture()
assert {:error, %Ecto.Changeset{}} = Conversations.update_conversation(conversation, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Conversations.update_conversation(conversation, @invalid_attrs)
assert conversation == Conversations.get_conversation!(conversation.id) assert conversation == Conversations.get_conversation!(conversation.id)
end end

View file

@ -39,7 +39,9 @@ defmodule Philomena.DnpEntriesTest do
test "update_dnp_entry/2 with valid data updates the dnp_entry" do test "update_dnp_entry/2 with valid data updates the dnp_entry" do
dnp_entry = dnp_entry_fixture() dnp_entry = dnp_entry_fixture()
assert {:ok, %DnpEntry{} = dnp_entry} = DnpEntries.update_dnp_entry(dnp_entry, @update_attrs)
assert {:ok, %DnpEntry{} = dnp_entry} =
DnpEntries.update_dnp_entry(dnp_entry, @update_attrs)
end end
test "update_dnp_entry/2 with invalid data returns error changeset" do test "update_dnp_entry/2 with invalid data returns error changeset" do

View file

@ -30,28 +30,40 @@ defmodule Philomena.DuplicateReportsTest do
end end
test "create_duplicate_report/1 with valid data creates a duplicate_report" do test "create_duplicate_report/1 with valid data creates a duplicate_report" do
assert {:ok, %DuplicateReport{} = duplicate_report} = DuplicateReports.create_duplicate_report(@valid_attrs) assert {:ok, %DuplicateReport{} = duplicate_report} =
DuplicateReports.create_duplicate_report(@valid_attrs)
end end
test "create_duplicate_report/1 with invalid data returns error changeset" do test "create_duplicate_report/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = DuplicateReports.create_duplicate_report(@invalid_attrs) assert {:error, %Ecto.Changeset{}} =
DuplicateReports.create_duplicate_report(@invalid_attrs)
end end
test "update_duplicate_report/2 with valid data updates the duplicate_report" do test "update_duplicate_report/2 with valid data updates the duplicate_report" do
duplicate_report = duplicate_report_fixture() duplicate_report = duplicate_report_fixture()
assert {:ok, %DuplicateReport{} = duplicate_report} = DuplicateReports.update_duplicate_report(duplicate_report, @update_attrs)
assert {:ok, %DuplicateReport{} = duplicate_report} =
DuplicateReports.update_duplicate_report(duplicate_report, @update_attrs)
end end
test "update_duplicate_report/2 with invalid data returns error changeset" do test "update_duplicate_report/2 with invalid data returns error changeset" do
duplicate_report = duplicate_report_fixture() duplicate_report = duplicate_report_fixture()
assert {:error, %Ecto.Changeset{}} = DuplicateReports.update_duplicate_report(duplicate_report, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
DuplicateReports.update_duplicate_report(duplicate_report, @invalid_attrs)
assert duplicate_report == DuplicateReports.get_duplicate_report!(duplicate_report.id) assert duplicate_report == DuplicateReports.get_duplicate_report!(duplicate_report.id)
end end
test "delete_duplicate_report/1 deletes the duplicate_report" do test "delete_duplicate_report/1 deletes the duplicate_report" do
duplicate_report = duplicate_report_fixture() duplicate_report = duplicate_report_fixture()
assert {:ok, %DuplicateReport{}} = DuplicateReports.delete_duplicate_report(duplicate_report)
assert_raise Ecto.NoResultsError, fn -> DuplicateReports.get_duplicate_report!(duplicate_report.id) end assert {:ok, %DuplicateReport{}} =
DuplicateReports.delete_duplicate_report(duplicate_report)
assert_raise Ecto.NoResultsError, fn ->
DuplicateReports.get_duplicate_report!(duplicate_report.id)
end
end end
test "change_duplicate_report/1 returns a duplicate_report changeset" do test "change_duplicate_report/1 returns a duplicate_report changeset" do

View file

@ -210,12 +210,17 @@ defmodule Philomena.ForumsTest do
test "update_subscription/2 with valid data updates the subscription" do test "update_subscription/2 with valid data updates the subscription" do
subscription = subscription_fixture() subscription = subscription_fixture()
assert {:ok, %Subscription{} = subscription} = Forums.update_subscription(subscription, @update_attrs)
assert {:ok, %Subscription{} = subscription} =
Forums.update_subscription(subscription, @update_attrs)
end end
test "update_subscription/2 with invalid data returns error changeset" do test "update_subscription/2 with invalid data returns error changeset" do
subscription = subscription_fixture() subscription = subscription_fixture()
assert {:error, %Ecto.Changeset{}} = Forums.update_subscription(subscription, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Forums.update_subscription(subscription, @invalid_attrs)
assert subscription == Forums.get_subscription!(subscription.id) assert subscription == Forums.get_subscription!(subscription.id)
end end
@ -372,7 +377,8 @@ defmodule Philomena.ForumsTest do
end end
test "create_topic_subscription/1 with valid data creates a topic_subscription" do test "create_topic_subscription/1 with valid data creates a topic_subscription" do
assert {:ok, %TopicSubscription{} = topic_subscription} = Forums.create_topic_subscription(@valid_attrs) assert {:ok, %TopicSubscription{} = topic_subscription} =
Forums.create_topic_subscription(@valid_attrs)
end end
test "create_topic_subscription/1 with invalid data returns error changeset" do test "create_topic_subscription/1 with invalid data returns error changeset" do
@ -381,19 +387,27 @@ defmodule Philomena.ForumsTest do
test "update_topic_subscription/2 with valid data updates the topic_subscription" do test "update_topic_subscription/2 with valid data updates the topic_subscription" do
topic_subscription = topic_subscription_fixture() topic_subscription = topic_subscription_fixture()
assert {:ok, %TopicSubscription{} = topic_subscription} = Forums.update_topic_subscription(topic_subscription, @update_attrs)
assert {:ok, %TopicSubscription{} = topic_subscription} =
Forums.update_topic_subscription(topic_subscription, @update_attrs)
end end
test "update_topic_subscription/2 with invalid data returns error changeset" do test "update_topic_subscription/2 with invalid data returns error changeset" do
topic_subscription = topic_subscription_fixture() topic_subscription = topic_subscription_fixture()
assert {:error, %Ecto.Changeset{}} = Forums.update_topic_subscription(topic_subscription, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Forums.update_topic_subscription(topic_subscription, @invalid_attrs)
assert topic_subscription == Forums.get_topic_subscription!(topic_subscription.id) assert topic_subscription == Forums.get_topic_subscription!(topic_subscription.id)
end end
test "delete_topic_subscription/1 deletes the topic_subscription" do test "delete_topic_subscription/1 deletes the topic_subscription" do
topic_subscription = topic_subscription_fixture() topic_subscription = topic_subscription_fixture()
assert {:ok, %TopicSubscription{}} = Forums.delete_topic_subscription(topic_subscription) assert {:ok, %TopicSubscription{}} = Forums.delete_topic_subscription(topic_subscription)
assert_raise Ecto.NoResultsError, fn -> Forums.get_topic_subscription!(topic_subscription.id) end
assert_raise Ecto.NoResultsError, fn ->
Forums.get_topic_subscription!(topic_subscription.id)
end
end end
test "change_topic_subscription/1 returns a topic_subscription changeset" do test "change_topic_subscription/1 returns a topic_subscription changeset" do

View file

@ -96,12 +96,17 @@ defmodule Philomena.GalleriesTest do
test "update_subscription/2 with valid data updates the subscription" do test "update_subscription/2 with valid data updates the subscription" do
subscription = subscription_fixture() subscription = subscription_fixture()
assert {:ok, %Subscription{} = subscription} = Galleries.update_subscription(subscription, @update_attrs)
assert {:ok, %Subscription{} = subscription} =
Galleries.update_subscription(subscription, @update_attrs)
end end
test "update_subscription/2 with invalid data returns error changeset" do test "update_subscription/2 with invalid data returns error changeset" do
subscription = subscription_fixture() subscription = subscription_fixture()
assert {:error, %Ecto.Changeset{}} = Galleries.update_subscription(subscription, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Galleries.update_subscription(subscription, @invalid_attrs)
assert subscription == Galleries.get_subscription!(subscription.id) assert subscription == Galleries.get_subscription!(subscription.id)
end end

View file

@ -153,7 +153,9 @@ defmodule Philomena.ImagesTest do
test "update_intensities/2 with valid data updates the intensities" do test "update_intensities/2 with valid data updates the intensities" do
intensities = intensities_fixture() intensities = intensities_fixture()
assert {:ok, %Intensities{} = intensities} = Images.update_intensities(intensities, @update_attrs)
assert {:ok, %Intensities{} = intensities} =
Images.update_intensities(intensities, @update_attrs)
end end
test "update_intensities/2 with invalid data returns error changeset" do test "update_intensities/2 with invalid data returns error changeset" do
@ -210,12 +212,17 @@ defmodule Philomena.ImagesTest do
test "update_subscription/2 with valid data updates the subscription" do test "update_subscription/2 with valid data updates the subscription" do
subscription = subscription_fixture() subscription = subscription_fixture()
assert {:ok, %Subscription{} = subscription} = Images.update_subscription(subscription, @update_attrs)
assert {:ok, %Subscription{} = subscription} =
Images.update_subscription(subscription, @update_attrs)
end end
test "update_subscription/2 with invalid data returns error changeset" do test "update_subscription/2 with invalid data returns error changeset" do
subscription = subscription_fixture() subscription = subscription_fixture()
assert {:error, %Ecto.Changeset{}} = Images.update_subscription(subscription, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Images.update_subscription(subscription, @invalid_attrs)
assert subscription == Images.get_subscription!(subscription.id) assert subscription == Images.get_subscription!(subscription.id)
end end
@ -267,12 +274,17 @@ defmodule Philomena.ImagesTest do
test "update_source_change/2 with valid data updates the source_change" do test "update_source_change/2 with valid data updates the source_change" do
source_change = source_change_fixture() source_change = source_change_fixture()
assert {:ok, %SourceChange{} = source_change} = Images.update_source_change(source_change, @update_attrs)
assert {:ok, %SourceChange{} = source_change} =
Images.update_source_change(source_change, @update_attrs)
end end
test "update_source_change/2 with invalid data returns error changeset" do test "update_source_change/2 with invalid data returns error changeset" do
source_change = source_change_fixture() source_change = source_change_fixture()
assert {:error, %Ecto.Changeset{}} = Images.update_source_change(source_change, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Images.update_source_change(source_change, @invalid_attrs)
assert source_change == Images.get_source_change!(source_change.id) assert source_change == Images.get_source_change!(source_change.id)
end end
@ -324,7 +336,9 @@ defmodule Philomena.ImagesTest do
test "update_tag_change/2 with valid data updates the tag_change" do test "update_tag_change/2 with valid data updates the tag_change" do
tag_change = tag_change_fixture() tag_change = tag_change_fixture()
assert {:ok, %TagChange{} = tag_change} = Images.update_tag_change(tag_change, @update_attrs)
assert {:ok, %TagChange{} = tag_change} =
Images.update_tag_change(tag_change, @update_attrs)
end end
test "update_tag_change/2 with invalid data returns error changeset" do test "update_tag_change/2 with invalid data returns error changeset" do

View file

@ -30,7 +30,8 @@ defmodule Philomena.NotificationsTest do
end end
test "create_notification/1 with valid data creates a notification" do test "create_notification/1 with valid data creates a notification" do
assert {:ok, %Notification{} = notification} = Notifications.create_notification(@valid_attrs) assert {:ok, %Notification{} = notification} =
Notifications.create_notification(@valid_attrs)
end end
test "create_notification/1 with invalid data returns error changeset" do test "create_notification/1 with invalid data returns error changeset" do
@ -39,12 +40,17 @@ defmodule Philomena.NotificationsTest do
test "update_notification/2 with valid data updates the notification" do test "update_notification/2 with valid data updates the notification" do
notification = notification_fixture() notification = notification_fixture()
assert {:ok, %Notification{} = notification} = Notifications.update_notification(notification, @update_attrs)
assert {:ok, %Notification{} = notification} =
Notifications.update_notification(notification, @update_attrs)
end end
test "update_notification/2 with invalid data returns error changeset" do test "update_notification/2 with invalid data returns error changeset" do
notification = notification_fixture() notification = notification_fixture()
assert {:error, %Ecto.Changeset{}} = Notifications.update_notification(notification, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Notifications.update_notification(notification, @invalid_attrs)
assert notification == Notifications.get_notification!(notification.id) assert notification == Notifications.get_notification!(notification.id)
end end
@ -87,28 +93,40 @@ defmodule Philomena.NotificationsTest do
end end
test "create_unread_notification/1 with valid data creates a unread_notification" do test "create_unread_notification/1 with valid data creates a unread_notification" do
assert {:ok, %UnreadNotification{} = unread_notification} = Notifications.create_unread_notification(@valid_attrs) assert {:ok, %UnreadNotification{} = unread_notification} =
Notifications.create_unread_notification(@valid_attrs)
end end
test "create_unread_notification/1 with invalid data returns error changeset" do test "create_unread_notification/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = Notifications.create_unread_notification(@invalid_attrs) assert {:error, %Ecto.Changeset{}} =
Notifications.create_unread_notification(@invalid_attrs)
end end
test "update_unread_notification/2 with valid data updates the unread_notification" do test "update_unread_notification/2 with valid data updates the unread_notification" do
unread_notification = unread_notification_fixture() unread_notification = unread_notification_fixture()
assert {:ok, %UnreadNotification{} = unread_notification} = Notifications.update_unread_notification(unread_notification, @update_attrs)
assert {:ok, %UnreadNotification{} = unread_notification} =
Notifications.update_unread_notification(unread_notification, @update_attrs)
end end
test "update_unread_notification/2 with invalid data returns error changeset" do test "update_unread_notification/2 with invalid data returns error changeset" do
unread_notification = unread_notification_fixture() unread_notification = unread_notification_fixture()
assert {:error, %Ecto.Changeset{}} = Notifications.update_unread_notification(unread_notification, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
Notifications.update_unread_notification(unread_notification, @invalid_attrs)
assert unread_notification == Notifications.get_unread_notification!(unread_notification.id) assert unread_notification == Notifications.get_unread_notification!(unread_notification.id)
end end
test "delete_unread_notification/1 deletes the unread_notification" do test "delete_unread_notification/1 deletes the unread_notification" do
unread_notification = unread_notification_fixture() unread_notification = unread_notification_fixture()
assert {:ok, %UnreadNotification{}} = Notifications.delete_unread_notification(unread_notification)
assert_raise Ecto.NoResultsError, fn -> Notifications.get_unread_notification!(unread_notification.id) end assert {:ok, %UnreadNotification{}} =
Notifications.delete_unread_notification(unread_notification)
assert_raise Ecto.NoResultsError, fn ->
Notifications.get_unread_notification!(unread_notification.id)
end
end end
test "change_unread_notification/1 returns a unread_notification changeset" do test "change_unread_notification/1 returns a unread_notification changeset" do

View file

@ -39,12 +39,17 @@ defmodule Philomena.SiteNoticesTest do
test "update_site_notice/2 with valid data updates the site_notice" do test "update_site_notice/2 with valid data updates the site_notice" do
site_notice = site_notice_fixture() site_notice = site_notice_fixture()
assert {:ok, %SiteNotice{} = site_notice} = SiteNotices.update_site_notice(site_notice, @update_attrs)
assert {:ok, %SiteNotice{} = site_notice} =
SiteNotices.update_site_notice(site_notice, @update_attrs)
end end
test "update_site_notice/2 with invalid data returns error changeset" do test "update_site_notice/2 with invalid data returns error changeset" do
site_notice = site_notice_fixture() site_notice = site_notice_fixture()
assert {:error, %Ecto.Changeset{}} = SiteNotices.update_site_notice(site_notice, @invalid_attrs)
assert {:error, %Ecto.Changeset{}} =
SiteNotices.update_site_notice(site_notice, @invalid_attrs)
assert site_notice == SiteNotices.get_site_notice!(site_notice.id) assert site_notice == SiteNotices.get_site_notice!(site_notice.id)
end end

View file

@ -96,7 +96,9 @@ defmodule Philomena.TagsTest do
test "update_implication/2 with valid data updates the implication" do test "update_implication/2 with valid data updates the implication" do
implication = implication_fixture() implication = implication_fixture()
assert {:ok, %Implication{} = implication} = Tags.update_implication(implication, @update_attrs)
assert {:ok, %Implication{} = implication} =
Tags.update_implication(implication, @update_attrs)
end end
test "update_implication/2 with invalid data returns error changeset" do test "update_implication/2 with invalid data returns error changeset" do

View file

@ -96,7 +96,9 @@ defmodule Philomena.UsersTest do
test "update_fingerprints/2 with valid data updates the fingerprints" do test "update_fingerprints/2 with valid data updates the fingerprints" do
fingerprints = fingerprints_fixture() fingerprints = fingerprints_fixture()
assert {:ok, %Fingerprints{} = fingerprints} = Users.update_fingerprints(fingerprints, @update_attrs)
assert {:ok, %Fingerprints{} = fingerprints} =
Users.update_fingerprints(fingerprints, @update_attrs)
end end
test "update_fingerprints/2 with invalid data returns error changeset" do test "update_fingerprints/2 with invalid data returns error changeset" do
@ -210,7 +212,9 @@ defmodule Philomena.UsersTest do
test "update_name_change/2 with valid data updates the name_change" do test "update_name_change/2 with valid data updates the name_change" do
name_change = name_change_fixture() name_change = name_change_fixture()
assert {:ok, %NameChange{} = name_change} = Users.update_name_change(name_change, @update_attrs)
assert {:ok, %NameChange{} = name_change} =
Users.update_name_change(name_change, @update_attrs)
end end
test "update_name_change/2 with invalid data returns error changeset" do test "update_name_change/2 with invalid data returns error changeset" do