switch mp3 to tts, add genserver to app supervisor tree that periodically checks for newly connected devices and plays their associated tts message

This commit is contained in:
2024-07-17 18:20:05 -04:00
parent 8668405143
commit a085aee5c8
18 changed files with 101 additions and 200 deletions

View File

@@ -8,7 +8,7 @@ defmodule HereIAm.DevicesTest do
import HereIAm.DevicesFixtures
@invalid_attrs %{ip_address: nil, audio: nil}
@invalid_attrs %{ip_address: nil, tts: nil}
test "list_devices/0 returns all devices" do
device = device_fixture()
@@ -21,11 +21,11 @@ defmodule HereIAm.DevicesTest do
end
test "create_device/1 with valid data creates a device" do
valid_attrs = %{ip_address: "some ip_address", audio: "some audio"}
valid_attrs = %{ip_address: "some ip_address", tts: "some tts"}
assert {:ok, %Device{} = device} = Devices.create_device(valid_attrs)
assert device.ip_address == "some ip_address"
assert device.audio == "some audio"
assert device.tts == "some tts"
end
test "create_device/1 with invalid data returns error changeset" do
@@ -34,11 +34,11 @@ defmodule HereIAm.DevicesTest do
test "update_device/2 with valid data updates the device" do
device = device_fixture()
update_attrs = %{ip_address: "some updated ip_address", audio: "some updated audio"}
update_attrs = %{ip_address: "some updated ip_address", tts: "some updated tts"}
assert {:ok, %Device{} = device} = Devices.update_device(device, update_attrs)
assert device.ip_address == "some updated ip_address"
assert device.audio == "some updated audio"
assert device.tts == "some updated tts"
end
test "update_device/2 with invalid data returns error changeset" do

View File

@@ -3,6 +3,6 @@ defmodule HereIAmWeb.PageControllerTest do
test "GET /", %{conn: conn} do
conn = get(conn, ~p"/")
assert html_response(conn, 200) =~ "Peace of mind from prototype to production"
assert html_response(conn, 200) =~ "This site allows you to set a message to play when your device connects to the network"
end
end

View File

@@ -4,9 +4,9 @@ defmodule HereIAmWeb.DeviceLiveTest do
import Phoenix.LiveViewTest
import HereIAm.DevicesFixtures
@create_attrs %{ip_address: "some ip_address", audio: "some audio"}
@update_attrs %{ip_address: "some updated ip_address", audio: "some updated audio"}
@invalid_attrs %{ip_address: nil, audio: nil}
@create_attrs %{ip_address: "some ip_address", tts: "some tts"}
@update_attrs %{ip_address: "some updated ip_address", tts: "some updated tts"}
@invalid_attrs %{ip_address: nil, tts: nil}
defp create_device(_) do
device = device_fixture()

View File

@@ -11,7 +11,7 @@ defmodule HereIAm.DevicesFixtures do
{:ok, device} =
attrs
|> Enum.into(%{
audio: "some audio",
tts: "some tts",
ip_address: "some ip_address"
})
|> HereIAm.Devices.create_device()