Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove off-axis ODLC targets from interop-proxy tests #77

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions services/interop-proxy/test/interop_proxy/request_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ defmodule InteropProxy.RequestTest do
assert end_count === starting_count - 1
end

test "add an off axis and emergent odlc" do
test "add a standard and emergent odlc" do
{:ok, _, cookie} = Request.login url(), username(), password()

# Getting the reference count (in case the interop server was not
# newly created).
get_count = fn ->
{:ok, all_odlc} = Request.get_odlcs url(), cookie, mission_id()

off_axis_count = Enum.count(all_odlc, fn
standard_count = Enum.count(all_odlc, fn
%{
"type" => "OFF_AXIS", "latitude" => 12.345, "longitude" => 34.567
"type" => "STANDARD", "latitude" => 12.345, "longitude" => 34.567
} -> true
_ -> false
end)
Expand All @@ -112,13 +112,13 @@ defmodule InteropProxy.RequestTest do
_ -> false
end)

{off_axis_count, emergent_count}
{standard_count, emergent_count}
end

{start_oa, start_e} = get_count.()

{:ok, %{"id" => id_1}} = Request.post_odlc url(), cookie, %{
type: "OFF_AXIS", latitude: 12.345, longitude: 34.567
type: "STANDARD", latitude: 12.345, longitude: 34.567
}, mission_id()

image_2 = TestHelper.get_image "image-2.jpg"
Expand Down
2 changes: 1 addition & 1 deletion services/interop-proxy/test/interop_proxy/session_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule InteropProxy.SessionTest do
{:ok, odlcs} = Request.get_odlcs s_url, s_cookie, mission_id()
start_len = length odlcs

{:ok, _} = Request.post_odlc s_url, s_cookie, %{type: "OFF_AXIS"}, \
{:ok, _} = Request.post_odlc s_url, s_cookie, %{type: "STANDARD"}, \
mission_id()

{:ok, odlcs} = Request.get_odlcs s_url, s_cookie, mission_id()
Expand Down
6 changes: 3 additions & 3 deletions services/interop-proxy/test/interop_proxy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ defmodule InteropProxyTest do

# Posting a new odlc.
%{id: id} = post_odlc! %Odlc{
type: :OFF_AXIS, shape: :SQUARE, background_color: :RED, image: image_1
type: :STANDARD, shape: :SQUARE, background_color: :RED, image: image_1
}

# Updating it.
returned = put_odlc! id, %Odlc{
type: :OFF_AXIS, background_color: :BLUE, orientation: :SOUTH
type: :STANDARD, background_color: :BLUE, orientation: :SOUTH
}

# Since we're using structs, the default value of shape will be
Expand All @@ -119,7 +119,7 @@ defmodule InteropProxyTest do
assert get_odlc!(id, image: true).image === image_1

# Updating it with an image as well.
returned = put_odlc! id, %Odlc{type: :OFF_AXIS, image: image_2}
returned = put_odlc! id, %Odlc{type: :STANDARD, image: image_2}

assert returned.shape === :UNKNOWN_SHAPE
assert returned.background_color === :UNKNOWN_COLOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule InteropProxyWeb.OdlcControllerTest do
image_2 = TestHelper.get_image "image-2.jpg"

odlc = post_odlc! %Odlc{
type: :OFF_AXIS,
type: :STANDARD,
pos: %Position{lat: 60, lon: 50},
image: image_2
}
Expand All @@ -27,7 +27,7 @@ defmodule InteropProxyWeb.OdlcControllerTest do

odlc = Enum.find response.list, &(&1.id === context.id)

assert odlc.type === :OFF_AXIS
assert odlc.type === :STANDARD
assert odlc.pos.lat == 60
assert odlc.pos.lon == 50
assert odlc.image === <<>>
Expand All @@ -40,7 +40,7 @@ defmodule InteropProxyWeb.OdlcControllerTest do

odlc = Enum.find response.list, &(&1.id === context.id)

assert odlc.type === :OFF_AXIS
assert odlc.type === :STANDARD
assert odlc.pos.lat == 60
assert odlc.pos.lon == 50
assert odlc.image === context.image
Expand All @@ -54,7 +54,7 @@ defmodule InteropProxyWeb.OdlcControllerTest do

odlc = Enum.find response["list"], &(&1["id"] === context.id)

assert odlc["type"] === "OFF_AXIS"
assert odlc["type"] === "STANDARD"
assert odlc["pos"]["lat"] == 60
assert odlc["pos"]["lon"] == 50
assert odlc["image"] === <<>>
Expand All @@ -68,7 +68,7 @@ defmodule InteropProxyWeb.OdlcControllerTest do

odlc = Enum.find response["list"], &(&1["id"] === context.id)

assert odlc["type"] === "OFF_AXIS"
assert odlc["type"] === "STANDARD"
assert odlc["pos"]["lat"] == 60
assert odlc["pos"]["lon"] == 50
assert odlc["image"] === Base.encode64(context.image)
Expand Down Expand Up @@ -151,13 +151,13 @@ defmodule InteropProxyWeb.OdlcControllerTest do
response = context.conn
|> put_req_header("content-type", "application/x-protobuf")
|> post(odlc_path(context.conn, :create), %Odlc{
type: :OFF_AXIS,
type: :STANDARD,
shape: :RECTANGLE,
pos: %Position{lat: -1, lon: 1}
} |> Odlc.encode)
|> protobuf_response(Odlc)

assert response.type === :OFF_AXIS
assert response.type === :STANDARD
assert response.shape === :RECTANGLE
assert response.pos.lat == -1
assert response.pos.lon == 1
Expand All @@ -169,13 +169,13 @@ defmodule InteropProxyWeb.OdlcControllerTest do
response = context.conn
|> put_req_header("content-type", "application/x-protobuf")
|> post(odlc_path(context.conn, :create), %Odlc{
type: :OFF_AXIS,
type: :STANDARD,
shape: :TRAPEZOID,
image: context.image
} |> Odlc.encode)
|> protobuf_response(Odlc)

assert response.type === :OFF_AXIS
assert response.type === :STANDARD
assert response.shape === :TRAPEZOID
assert response.image === <<>>
end
Expand All @@ -185,13 +185,13 @@ defmodule InteropProxyWeb.OdlcControllerTest do
|> put_req_header("accept", "application/json")
|> put_req_header("content-type", "application/json")
|> post(odlc_path(context.conn, :create), %{
type: "OFF_AXIS",
type: "STANDARD",
shape: "RECTANGLE",
pos: %{lat: -1, lon: 1}
})
|> json_response(200)

assert response["type"] === "OFF_AXIS"
assert response["type"] === "STANDARD"
assert response["shape"] === "RECTANGLE"
assert response["pos"]["lat"] == -1
assert response["pos"]["lon"] == 1
Expand All @@ -204,13 +204,13 @@ defmodule InteropProxyWeb.OdlcControllerTest do
|> put_req_header("accept", "application/json")
|> put_req_header("content-type", "application/json")
|> post(odlc_path(context.conn, :create), %{
type: "OFF_AXIS",
type: "STANDARD",
shape: "TRAPEZOID",
image: Base.encode64(context.image)
})
|> json_response(200)

assert response["type"] === "OFF_AXIS"
assert response["type"] === "STANDARD"
assert response["shape"] === "TRAPEZOID"
assert response["image"] === <<>>
end
Expand Down Expand Up @@ -300,7 +300,7 @@ defmodule InteropProxyWeb.OdlcControllerTest do

describe "delete/2" do
setup _context do
odlc_1 = post_odlc! %Odlc{type: :OFF_AXIS}
odlc_1 = post_odlc! %Odlc{type: :STANDARD}
odlc_2 = post_odlc! %Odlc{type: :EMERGENT}

{:ok, id_1: odlc_1.id, id_2: odlc_2.id}
Expand Down