diff --git a/test/support/teiserver_test_lib.ex b/test/support/teiserver_test_lib.ex index 59d3e99cc..86ef591ae 100644 --- a/test/support/teiserver_test_lib.ex +++ b/test/support/teiserver_test_lib.ex @@ -527,10 +527,9 @@ defmodule Teiserver.TeiserverTestLib do Teiserver.Account.get_or_add_smurf_key_type("hw2") Teiserver.Account.get_or_add_smurf_key_type("hw3") - Teiserver.Game.get_or_add_rating_type("Duel") - Teiserver.Game.get_or_add_rating_type("Small Team") - Teiserver.Game.get_or_add_rating_type("Large Team") - Teiserver.Game.get_or_add_rating_type("FFA") + Enum.each(Teiserver.Game.MatchRatingLib.rating_type_list(), fn rating_type -> + Teiserver.Game.get_or_add_rating_type(rating_type) + end) Teiserver.Telemetry.get_or_add_complex_server_event_type("Server startup") Teiserver.Telemetry.get_or_add_simple_server_event_type("account.user_login") diff --git a/test/teiserver_web/controllers/api/spads_controller_test.exs b/test/teiserver_web/controllers/api/spads_controller_test.exs index 60d400c37..9e432862d 100644 --- a/test/teiserver_web/controllers/api/spads_controller_test.exs +++ b/test/teiserver_web/controllers/api/spads_controller_test.exs @@ -5,11 +5,13 @@ defmodule TeiserverWeb.API.SpadsControllerTest do alias Teiserver.Game.MatchRatingLib alias Teiserver.Coordinator alias Teiserver.Account.ClientLib + alias Teiserver.Client import Teiserver.TeiserverTestLib, only: [ new_user: 0, - new_user: 1 + new_user: 1, + make_lobby: 1 ] defp make_rating(userid, rating_type_id, rating_value) do @@ -34,7 +36,6 @@ defmodule TeiserverWeb.API.SpadsControllerTest do assert data == %{"rating_value" => 16.67, "uncertainty" => 8.33} end - @tag :needs_attention test "existing user", %{conn: conn} do user = new_user() rating_type_id = MatchRatingLib.rating_type_name_lookup()["Team"] @@ -50,6 +51,13 @@ defmodule TeiserverWeb.API.SpadsControllerTest do last_updated: Timex.now() }) + Client.login(user, :spring, "127.0.0.1") + + lobby_id = + make_lobby(%{name: "Test", founder_id: user.id, founder_name: user.name}) + + Client.join_battle(user.id, lobby_id, true) + conn = get(conn, Routes.ts_spads_path(conn, :get_rating, user.id, "Team")) response = response(conn, 200) data = Jason.decode!(response)