Skip to content

Commit

Permalink
Fix recording component request (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karolk99 authored Apr 3, 2024
1 parent 8bc4145 commit 4eb36e6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/jellyfish_web/api_spec/component/recording.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule JellyfishWeb.ApiSpec.Component.Recording do
pathPrefix: %Schema{
type: :string,
description: "Path prefix under which all recording are stored",
default: ""
default: nil
},
credentials: %Schema{
type: :object,
Expand Down
1 change: 0 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ components:
- $ref: '#/components/schemas/S3Credentials'
type: object
pathPrefix:
default: ''
description: Path prefix under which all recording are stored
type: string
title: ComponentOptionsRecording
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule JellyfishWeb.Component.RecordingComponentTest do

setup :set_mox_from_context

test "renders component when credentials are in passed in config", %{
test "renders component when credentials are passed in config", %{
conn: conn,
room_id: room_id
} do
Expand All @@ -73,6 +73,32 @@ defmodule JellyfishWeb.Component.RecordingComponentTest do
clean_s3_envs()
end

test "renders component when path prefix is passed in config", %{
conn: conn,
room_id: room_id
} do
mock_http_request()
put_s3_envs(path_prefix: @path_prefix, credentials: nil)

conn =
post(conn, ~p"/room/#{room_id}/component",
type: "recording",
options: %{credentials: Enum.into(@s3_credentials, %{})}
)

assert %{
"data" => %{
"id" => id,
"type" => "recording",
"properties" => %{"pathPrefix" => @path_prefix}
}
} = model_response(conn, :created, "ComponentDetailsResponse")

assert_component_created(conn, room_id, id, "recording")

clean_s3_envs()
end

test "renders error when credentials are passed both in config and request", %{
conn: conn,
room_id: room_id
Expand Down Expand Up @@ -100,7 +126,7 @@ defmodule JellyfishWeb.Component.RecordingComponentTest do
conn =
post(conn, ~p"/room/#{room_id}/component",
type: "recording",
options: %{path_prefix: @path_prefix}
options: %{pathPrefix: @path_prefix}
)

assert model_response(conn, :bad_request, "Error")["errors"] ==
Expand Down

0 comments on commit 4eb36e6

Please sign in to comment.