Fix tests
authorRoman Chvanikov <chvanikoff@gmail.com>
Fri, 19 Apr 2019 16:26:41 +0000 (23:26 +0700)
committerRoman Chvanikov <chvanikoff@gmail.com>
Fri, 19 Apr 2019 16:26:41 +0000 (23:26 +0700)
lib/pleroma/user.ex
test/notification_test.exs
test/support/builders/user_builder.ex
test/support/factory.ex

index c67a7b7a194b5166d254340291bfd5f78bfc8484..7053dfaf3ce821e0bdde8d8b43f8dfce8708ac73 100644 (file)
@@ -55,7 +55,6 @@ defmodule Pleroma.User do
     field(:tags, {:array, :string}, default: [])
     field(:bookmarks, {:array, :string}, default: [])
     field(:last_refreshed_at, :naive_datetime_usec)
-    field(:current_sign_in_at, :naive_datetime)
     field(:last_digest_emailed_at, :naive_datetime)
     has_many(:notifications, Notification)
     has_many(:registrations, Registration)
index dbc4f48f6971b77df3628abb94d0cc16bf777318..462398d7512bd05bde046e298a9981ab531e764c 100644 (file)
@@ -6,7 +6,6 @@ defmodule Pleroma.NotificationTest do
   use Pleroma.DataCase
 
   import Pleroma.Factory
-  import Mock
 
   alias Pleroma.Notification
   alias Pleroma.User
@@ -303,32 +302,6 @@ defmodule Pleroma.NotificationTest do
       assert n2.seen == true
       assert n3.seen == false
     end
-
-    test "Updates `updated_at` field" do
-      user1 = insert(:user)
-      user2 = insert(:user)
-
-      Enum.each(0..10, fn i ->
-        {:ok, _activity} =
-          TwitterAPI.create_status(user1, %{
-            "status" => "#{i} hi @#{user2.nickname}"
-          })
-      end)
-
-      [notification | _] = Notification.for_user(user2)
-
-      utc_now = NaiveDateTime.utc_now()
-      future = NaiveDateTime.add(utc_now, 5, :second)
-
-      with_mock NaiveDateTime, utc_now: fn -> future end do
-        Notification.set_read_up_to(user2, notification.id)
-
-        Notification.for_user(user2)
-        |> Enum.each(fn notification ->
-          assert notification.updated_at > notification.inserted_at
-        end)
-      end
-    end
   end
 
   describe "for_user_since/2" do
index f58e1b0ad370df0422fd623657b78334bb992664..6da16f71a90df664f9467633cfef851502f4c132 100644 (file)
@@ -9,7 +9,8 @@ defmodule Pleroma.Builders.UserBuilder do
       nickname: "testname",
       password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
       bio: "A tester.",
-      ap_id: "some id"
+      ap_id: "some id",
+      last_digest_emailed_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
     }
 
     Map.merge(user, data)
index ea59912cfbab3ef755afd7f2dc0ba21501765c04..0840f31ec13db39b02679f3b14d883b640199f26 100644 (file)
@@ -12,7 +12,8 @@ defmodule Pleroma.Factory do
       nickname: sequence(:nickname, &"nick#{&1}"),
       password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
       bio: sequence(:bio, &"Tester Number #{&1}"),
-      info: %{}
+      info: %{},
+      last_digest_emailed_at: NaiveDateTime.utc_now()
     }
 
     %{