rename ammo type to type
This commit is contained in:
@ -11,16 +11,16 @@ defmodule CanneryWeb.ExportControllerTest do
|
||||
setup [:register_and_log_in_user]
|
||||
|
||||
defp add_data(%{current_user: current_user}) do
|
||||
ammo_type = ammo_type_fixture(current_user)
|
||||
type = type_fixture(current_user)
|
||||
container = container_fixture(current_user)
|
||||
tag = tag_fixture(current_user)
|
||||
Containers.add_tag!(container, tag, current_user)
|
||||
{1, [pack]} = pack_fixture(ammo_type, container, current_user)
|
||||
{1, [pack]} = pack_fixture(type, container, current_user)
|
||||
shot_record = shot_record_fixture(current_user, pack)
|
||||
pack = pack |> Repo.reload!()
|
||||
|
||||
%{
|
||||
ammo_type: ammo_type,
|
||||
type: type,
|
||||
pack: pack,
|
||||
container: container,
|
||||
shot_record: shot_record,
|
||||
@ -35,7 +35,7 @@ defmodule CanneryWeb.ExportControllerTest do
|
||||
conn: conn,
|
||||
current_user: current_user,
|
||||
container: container,
|
||||
ammo_type: ammo_type,
|
||||
type: type,
|
||||
pack: pack,
|
||||
shot_record: shot_record,
|
||||
tag: tag
|
||||
@ -43,7 +43,7 @@ defmodule CanneryWeb.ExportControllerTest do
|
||||
conn = get(conn, Routes.export_path(conn, :export, :json))
|
||||
|
||||
ideal_pack = %{
|
||||
"ammo_type_id" => pack.ammo_type_id,
|
||||
"type_id" => pack.type_id,
|
||||
"container_id" => pack.container_id,
|
||||
"count" => pack.count,
|
||||
"id" => pack.id,
|
||||
@ -56,34 +56,34 @@ defmodule CanneryWeb.ExportControllerTest do
|
||||
"percentage_remaining" => pack |> Ammo.get_percentage_remaining(current_user)
|
||||
}
|
||||
|
||||
ideal_ammo_type = %{
|
||||
"blank" => ammo_type.blank,
|
||||
"bullet_core" => ammo_type.bullet_core,
|
||||
"bullet_type" => ammo_type.bullet_type,
|
||||
"caliber" => ammo_type.caliber,
|
||||
"cartridge" => ammo_type.cartridge,
|
||||
"case_material" => ammo_type.case_material,
|
||||
"corrosive" => ammo_type.corrosive,
|
||||
"desc" => ammo_type.desc,
|
||||
"firing_type" => ammo_type.firing_type,
|
||||
"grains" => ammo_type.grains,
|
||||
"id" => ammo_type.id,
|
||||
"incendiary" => ammo_type.incendiary,
|
||||
"jacket_type" => ammo_type.jacket_type,
|
||||
"manufacturer" => ammo_type.manufacturer,
|
||||
"muzzle_velocity" => ammo_type.muzzle_velocity,
|
||||
"name" => ammo_type.name,
|
||||
"powder_grains_per_charge" => ammo_type.powder_grains_per_charge,
|
||||
"powder_type" => ammo_type.powder_type,
|
||||
"pressure" => ammo_type.pressure,
|
||||
"primer_type" => ammo_type.primer_type,
|
||||
"tracer" => ammo_type.tracer,
|
||||
"upc" => ammo_type.upc,
|
||||
"average_cost" => ammo_type |> Ammo.get_average_cost_for_ammo_type(current_user),
|
||||
"round_count" => ammo_type |> Ammo.get_round_count_for_ammo_type(current_user),
|
||||
"used_count" => ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user),
|
||||
"pack_count" => ammo_type |> Ammo.get_packs_count_for_type(current_user),
|
||||
"total_pack_count" => ammo_type |> Ammo.get_packs_count_for_type(current_user, true)
|
||||
ideal_type = %{
|
||||
"blank" => type.blank,
|
||||
"bullet_core" => type.bullet_core,
|
||||
"bullet_type" => type.bullet_type,
|
||||
"caliber" => type.caliber,
|
||||
"cartridge" => type.cartridge,
|
||||
"case_material" => type.case_material,
|
||||
"corrosive" => type.corrosive,
|
||||
"desc" => type.desc,
|
||||
"firing_type" => type.firing_type,
|
||||
"grains" => type.grains,
|
||||
"id" => type.id,
|
||||
"incendiary" => type.incendiary,
|
||||
"jacket_type" => type.jacket_type,
|
||||
"manufacturer" => type.manufacturer,
|
||||
"muzzle_velocity" => type.muzzle_velocity,
|
||||
"name" => type.name,
|
||||
"powder_grains_per_charge" => type.powder_grains_per_charge,
|
||||
"powder_type" => type.powder_type,
|
||||
"pressure" => type.pressure,
|
||||
"primer_type" => type.primer_type,
|
||||
"tracer" => type.tracer,
|
||||
"upc" => type.upc,
|
||||
"average_cost" => type |> Ammo.get_average_cost_for_type(current_user),
|
||||
"round_count" => type |> Ammo.get_round_count_for_type(current_user),
|
||||
"used_count" => type |> ActivityLog.get_used_count_for_type(current_user),
|
||||
"pack_count" => type |> Ammo.get_packs_count_for_type(current_user),
|
||||
"total_pack_count" => type |> Ammo.get_packs_count_for_type(current_user, true)
|
||||
}
|
||||
|
||||
ideal_container = %{
|
||||
@ -125,7 +125,7 @@ defmodule CanneryWeb.ExportControllerTest do
|
||||
|
||||
json_resp = conn |> json_response(200)
|
||||
assert %{"packs" => [^ideal_pack]} = json_resp
|
||||
assert %{"ammo_types" => [^ideal_ammo_type]} = json_resp
|
||||
assert %{"types" => [^ideal_type]} = json_resp
|
||||
assert %{"containers" => [^ideal_container]} = json_resp
|
||||
assert %{"shot_records" => [^ideal_shot_record]} = json_resp
|
||||
assert %{"user" => ^ideal_user} = json_resp
|
||||
|
Reference in New Issue
Block a user