From 5085d3c9d1d13f6c9a117e954df4d15e38c30c13 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Wed, 28 Aug 2019 18:50:36 -0400 Subject: [PATCH] format --- config/config.exs | 3 +- lib/philomena/conversations/message.ex | 2 +- lib/philomena/dnp_entries/dnp_entry.ex | 2 +- lib/philomena/forums/poll_vote.ex | 1 - lib/philomena/images/intensities.ex | 2 +- test/philomena/badges_test.exs | 4 ++- test/philomena/bans_test.exs | 4 ++- test/philomena/commissions_test.exs | 9 ++++-- test/philomena/conversations_test.exs | 12 ++++++-- test/philomena/dnp_entries_test.exs | 4 ++- test/philomena/duplicate_reports_test.exs | 24 +++++++++++---- test/philomena/forums_test.exs | 26 ++++++++++++---- test/philomena/galleries_test.exs | 9 ++++-- test/philomena/images_test.exs | 26 ++++++++++++---- test/philomena/notifications_test.exs | 36 +++++++++++++++++------ test/philomena/site_notices_test.exs | 9 ++++-- test/philomena/tags_test.exs | 4 ++- test/philomena/users_test.exs | 8 +++-- 18 files changed, 137 insertions(+), 48 deletions(-) diff --git a/config/config.exs b/config/config.exs index dba99a01..4df8951b 100644 --- a/config/config.exs +++ b/config/config.exs @@ -32,8 +32,7 @@ config :philomena, PhilomenaWeb.Endpoint, render_errors: [view: PhilomenaWeb.ErrorView, accepts: ~w(html json)], pubsub: [name: Philomena.PubSub, adapter: Phoenix.PubSub.PG2] -config :philomena, :generators, - migration: false +config :philomena, :generators, migration: false config :phoenix, :template_engines, slim: PhoenixSlime.Engine, diff --git a/lib/philomena/conversations/message.ex b/lib/philomena/conversations/message.ex index c0846eeb..a015a87d 100644 --- a/lib/philomena/conversations/message.ex +++ b/lib/philomena/conversations/message.ex @@ -7,7 +7,7 @@ defmodule Philomena.Conversations.Message do belongs_to :from, Philomena.Users.User field :body, :string - + timestamps(inserted_at: :created_at) end diff --git a/lib/philomena/dnp_entries/dnp_entry.ex b/lib/philomena/dnp_entries/dnp_entry.ex index dfba0b9c..0b43e853 100644 --- a/lib/philomena/dnp_entries/dnp_entry.ex +++ b/lib/philomena/dnp_entries/dnp_entry.ex @@ -6,7 +6,7 @@ defmodule Philomena.DnpEntries.DnpEntry do belongs_to :requesting_user, Philomena.Users.User belongs_to :modifying_user, Philomena.Users.User belongs_to :tag, Philomena.Tags.Tag - + field :aasm_state, :string, default: "requested" field :dnp_type, :string field :conditions, :string diff --git a/lib/philomena/forums/poll_vote.ex b/lib/philomena/forums/poll_vote.ex index c4b1c6f9..57a13f6a 100644 --- a/lib/philomena/forums/poll_vote.ex +++ b/lib/philomena/forums/poll_vote.ex @@ -3,7 +3,6 @@ defmodule Philomena.Forums.PollVote do import Ecto.Changeset schema "poll_votes" do - timestamps() end diff --git a/lib/philomena/images/intensities.ex b/lib/philomena/images/intensities.ex index b662d552..8f942cca 100644 --- a/lib/philomena/images/intensities.ex +++ b/lib/philomena/images/intensities.ex @@ -6,7 +6,7 @@ defmodule Philomena.Images.Intensities do schema "image_intensities" do belongs_to :image, Philomena.Images.Image, primary_key: true - + field :nw, :float field :ne, :float field :sw, :float diff --git a/test/philomena/badges_test.exs b/test/philomena/badges_test.exs index 0911469e..72e9aed3 100644 --- a/test/philomena/badges_test.exs +++ b/test/philomena/badges_test.exs @@ -96,7 +96,9 @@ defmodule Philomena.BadgesTest do test "update_badge_award/2 with valid data updates the badge_award" do 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 test "update_badge_award/2 with invalid data returns error changeset" do diff --git a/test/philomena/bans_test.exs b/test/philomena/bans_test.exs index d527a09c..7e725fff 100644 --- a/test/philomena/bans_test.exs +++ b/test/philomena/bans_test.exs @@ -39,7 +39,9 @@ defmodule Philomena.BansTest do test "update_fingerprint/2 with valid data updates the fingerprint" do fingerprint = fingerprint_fixture() - assert {:ok, %Fingerprint{} = fingerprint} = Bans.update_fingerprint(fingerprint, @update_attrs) + + assert {:ok, %Fingerprint{} = fingerprint} = + Bans.update_fingerprint(fingerprint, @update_attrs) end test "update_fingerprint/2 with invalid data returns error changeset" do diff --git a/test/philomena/commissions_test.exs b/test/philomena/commissions_test.exs index 73c816e9..030f59fe 100644 --- a/test/philomena/commissions_test.exs +++ b/test/philomena/commissions_test.exs @@ -39,12 +39,17 @@ defmodule Philomena.CommissionsTest do test "update_commission/2 with valid data updates the commission" do commission = commission_fixture() - assert {:ok, %Commission{} = commission} = Commissions.update_commission(commission, @update_attrs) + + assert {:ok, %Commission{} = commission} = + Commissions.update_commission(commission, @update_attrs) end test "update_commission/2 with invalid data returns error changeset" do 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) end diff --git a/test/philomena/conversations_test.exs b/test/philomena/conversations_test.exs index 54fb1562..1107c73d 100644 --- a/test/philomena/conversations_test.exs +++ b/test/philomena/conversations_test.exs @@ -30,7 +30,8 @@ defmodule Philomena.ConversationsTest do end 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 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 conversation = conversation_fixture() - assert {:ok, %Conversation{} = conversation} = Conversations.update_conversation(conversation, @update_attrs) + + assert {:ok, %Conversation{} = conversation} = + Conversations.update_conversation(conversation, @update_attrs) end test "update_conversation/2 with invalid data returns error changeset" do 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) end diff --git a/test/philomena/dnp_entries_test.exs b/test/philomena/dnp_entries_test.exs index 81899c95..a0ad05c1 100644 --- a/test/philomena/dnp_entries_test.exs +++ b/test/philomena/dnp_entries_test.exs @@ -39,7 +39,9 @@ defmodule Philomena.DnpEntriesTest do test "update_dnp_entry/2 with valid data updates the dnp_entry" do 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 test "update_dnp_entry/2 with invalid data returns error changeset" do diff --git a/test/philomena/duplicate_reports_test.exs b/test/philomena/duplicate_reports_test.exs index a443952e..c0f1ff9f 100644 --- a/test/philomena/duplicate_reports_test.exs +++ b/test/philomena/duplicate_reports_test.exs @@ -30,28 +30,40 @@ defmodule Philomena.DuplicateReportsTest do end 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 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 test "update_duplicate_report/2 with valid data updates the duplicate_report" do 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 test "update_duplicate_report/2 with invalid data returns error changeset" do 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) end test "delete_duplicate_report/1 deletes the duplicate_report" do 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 test "change_duplicate_report/1 returns a duplicate_report changeset" do diff --git a/test/philomena/forums_test.exs b/test/philomena/forums_test.exs index 9c2efffa..3a03e017 100644 --- a/test/philomena/forums_test.exs +++ b/test/philomena/forums_test.exs @@ -210,12 +210,17 @@ defmodule Philomena.ForumsTest do test "update_subscription/2 with valid data updates the subscription" do subscription = subscription_fixture() - assert {:ok, %Subscription{} = subscription} = Forums.update_subscription(subscription, @update_attrs) + + assert {:ok, %Subscription{} = subscription} = + Forums.update_subscription(subscription, @update_attrs) end test "update_subscription/2 with invalid data returns error changeset" do 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) end @@ -372,7 +377,8 @@ defmodule Philomena.ForumsTest do end 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 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 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 test "update_topic_subscription/2 with invalid data returns error changeset" do 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) end test "delete_topic_subscription/1 deletes the topic_subscription" do topic_subscription = topic_subscription_fixture() 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 test "change_topic_subscription/1 returns a topic_subscription changeset" do diff --git a/test/philomena/galleries_test.exs b/test/philomena/galleries_test.exs index 74c17d73..68f78640 100644 --- a/test/philomena/galleries_test.exs +++ b/test/philomena/galleries_test.exs @@ -96,12 +96,17 @@ defmodule Philomena.GalleriesTest do test "update_subscription/2 with valid data updates the subscription" do subscription = subscription_fixture() - assert {:ok, %Subscription{} = subscription} = Galleries.update_subscription(subscription, @update_attrs) + + assert {:ok, %Subscription{} = subscription} = + Galleries.update_subscription(subscription, @update_attrs) end test "update_subscription/2 with invalid data returns error changeset" do 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) end diff --git a/test/philomena/images_test.exs b/test/philomena/images_test.exs index 177535a4..186f65ad 100644 --- a/test/philomena/images_test.exs +++ b/test/philomena/images_test.exs @@ -153,7 +153,9 @@ defmodule Philomena.ImagesTest do test "update_intensities/2 with valid data updates the intensities" do intensities = intensities_fixture() - assert {:ok, %Intensities{} = intensities} = Images.update_intensities(intensities, @update_attrs) + + assert {:ok, %Intensities{} = intensities} = + Images.update_intensities(intensities, @update_attrs) end 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 subscription = subscription_fixture() - assert {:ok, %Subscription{} = subscription} = Images.update_subscription(subscription, @update_attrs) + + assert {:ok, %Subscription{} = subscription} = + Images.update_subscription(subscription, @update_attrs) end test "update_subscription/2 with invalid data returns error changeset" do 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) end @@ -267,12 +274,17 @@ defmodule Philomena.ImagesTest do test "update_source_change/2 with valid data updates the source_change" do 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 test "update_source_change/2 with invalid data returns error changeset" do 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) end @@ -324,7 +336,9 @@ defmodule Philomena.ImagesTest do test "update_tag_change/2 with valid data updates the tag_change" do 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 test "update_tag_change/2 with invalid data returns error changeset" do diff --git a/test/philomena/notifications_test.exs b/test/philomena/notifications_test.exs index 9a00a272..82ae0e32 100644 --- a/test/philomena/notifications_test.exs +++ b/test/philomena/notifications_test.exs @@ -30,7 +30,8 @@ defmodule Philomena.NotificationsTest do end 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 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 notification = notification_fixture() - assert {:ok, %Notification{} = notification} = Notifications.update_notification(notification, @update_attrs) + + assert {:ok, %Notification{} = notification} = + Notifications.update_notification(notification, @update_attrs) end test "update_notification/2 with invalid data returns error changeset" do 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) end @@ -87,28 +93,40 @@ defmodule Philomena.NotificationsTest do end 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 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 test "update_unread_notification/2 with valid data updates the unread_notification" do 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 test "update_unread_notification/2 with invalid data returns error changeset" do 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) end test "delete_unread_notification/1 deletes the unread_notification" do 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 test "change_unread_notification/1 returns a unread_notification changeset" do diff --git a/test/philomena/site_notices_test.exs b/test/philomena/site_notices_test.exs index 5d56d7be..766e392c 100644 --- a/test/philomena/site_notices_test.exs +++ b/test/philomena/site_notices_test.exs @@ -39,12 +39,17 @@ defmodule Philomena.SiteNoticesTest do test "update_site_notice/2 with valid data updates the site_notice" do 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 test "update_site_notice/2 with invalid data returns error changeset" do 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) end diff --git a/test/philomena/tags_test.exs b/test/philomena/tags_test.exs index 78b41e87..7cdf9f83 100644 --- a/test/philomena/tags_test.exs +++ b/test/philomena/tags_test.exs @@ -96,7 +96,9 @@ defmodule Philomena.TagsTest do test "update_implication/2 with valid data updates the implication" do implication = implication_fixture() - assert {:ok, %Implication{} = implication} = Tags.update_implication(implication, @update_attrs) + + assert {:ok, %Implication{} = implication} = + Tags.update_implication(implication, @update_attrs) end test "update_implication/2 with invalid data returns error changeset" do diff --git a/test/philomena/users_test.exs b/test/philomena/users_test.exs index 54be4b39..a1dae1ae 100644 --- a/test/philomena/users_test.exs +++ b/test/philomena/users_test.exs @@ -96,7 +96,9 @@ defmodule Philomena.UsersTest do test "update_fingerprints/2 with valid data updates the fingerprints" do fingerprints = fingerprints_fixture() - assert {:ok, %Fingerprints{} = fingerprints} = Users.update_fingerprints(fingerprints, @update_attrs) + + assert {:ok, %Fingerprints{} = fingerprints} = + Users.update_fingerprints(fingerprints, @update_attrs) end 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 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 test "update_name_change/2 with invalid data returns error changeset" do