This commit is contained in:
dtluna 2017-04-16 17:05:48 +03:00
parent 4b4ece2c74
commit 63f04b314d
2 changed files with 2 additions and 2 deletions

View file

@ -275,7 +275,7 @@ def get_user(user, params) do
if user do if user do
{:ok, user} {:ok, user}
else else
{:error, "You need to specify screen_name of user_id"} {:error, "You need to specify screen_name or user_id"}
end end
end end
end end

View file

@ -106,7 +106,7 @@ test "get a user by params" do
user1_result = {:ok, user1} = UserBuilder.insert(%{ap_id: "some id", email: "test@pleroma"}) user1_result = {:ok, user1} = UserBuilder.insert(%{ap_id: "some id", email: "test@pleroma"})
{:ok, user2} = UserBuilder.insert(%{ap_id: "some other id", nickname: "testname2", email: "test2@pleroma"}) {:ok, user2} = UserBuilder.insert(%{ap_id: "some other id", nickname: "testname2", email: "test2@pleroma"})
assert {:error, "You need to specify screen_name of user_id"} == TwitterAPI.get_user(nil, nil) assert {:error, "You need to specify screen_name or user_id"} == TwitterAPI.get_user(nil, nil)
assert user1_result == TwitterAPI.get_user(nil, %{"user_id" => user1.id}) assert user1_result == TwitterAPI.get_user(nil, %{"user_id" => user1.id})
assert user1_result == TwitterAPI.get_user(nil, %{"screen_name" => user1.nickname}) assert user1_result == TwitterAPI.get_user(nil, %{"screen_name" => user1.nickname})
assert user1_result == TwitterAPI.get_user(user1, nil) assert user1_result == TwitterAPI.get_user(user1, nil)