Skip to content

Commit

Permalink
#10532 add test case for non-implemented GetNTP(dahua)
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloo committed Jul 18, 2024
1 parent f0bd3f0 commit 9904ad4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/devices/fixtures/invalid_get_ntp_response.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<s:Envelope
xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:sc="http://www.w3.org/2003/05/soap-encoding"
xmlns:ter="http://www.onvif.org/ver10/error"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery">
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value>ter:ActionNotSupported</s:Value>
<s:Subcode>
<s:Value>ter:NotImplemented</s:Value>
</s:Subcode>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en">This optional method is not implemented</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
12 changes: 12 additions & 0 deletions test/devices/get_ntp.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9904ad4

Please sign in to comment.