diff --git a/test/devices/fixtures/invalid_get_ntp_response.xml b/test/devices/fixtures/invalid_get_ntp_response.xml new file mode 100644 index 0000000..bba79e7 --- /dev/null +++ b/test/devices/fixtures/invalid_get_ntp_response.xml @@ -0,0 +1,25 @@ + + + + + + s:Sender + + ter:ActionNotSupported + + ter:NotImplemented + + + + + This optional method is not implemented + + + + \ No newline at end of file diff --git a/test/devices/get_ntp.exs b/test/devices/get_ntp.exs index ceba8a9..5283676 100644 --- a/test/devices/get_ntp.exs +++ b/test/devices/get_ntp.exs @@ -26,5 +26,17 @@ defmodule Onvif.Devices.GetNTPTest do } } end + + test "check a non-implemented GetNTP (dahua)" do + xml_response = File.read!("test/devices/fixtures/invalid_get_ntp_response.xml") + device = Onvif.Factory.device() + + Mimic.expect(Tesla, :request, fn _client, _opts -> + {:ok, %{status: 200, body: xml_response}} + end) + + {:ok, service_capabilities} = Onvif.Devices.GetNTP.request(device) + assert service_capabilities == nil + end end end