mirror of
https://github.com/onyx-and-iris/obsws-ruby.git
synced 2025-01-29 18:00:47 +00:00
check identified state in Event::Client
add passwordless test for event client patch bump
This commit is contained in:
parent
92174219a7
commit
7e580dc91a
@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
obsws (0.5.6)
|
||||
obsws (0.5.8)
|
||||
waitutil (~> 0.2.1)
|
||||
websocket-driver (~> 0.7.5)
|
||||
|
||||
|
@ -71,6 +71,11 @@ module OBSWS
|
||||
def initialize(**kwargs)
|
||||
kwargs[:subs] ||= SUBS::LOW_VOLUME
|
||||
@base_client = Base.new(**kwargs)
|
||||
unless @base_client.identified.state == :identified
|
||||
err_msg = @base_client.identified.error_message
|
||||
logger.error(err_msg)
|
||||
raise OBSWSConnectionError.new(err_msg)
|
||||
end
|
||||
logger.info("#{self} successfully identified with server")
|
||||
rescue Errno::ECONNREFUSED, WaitUtil::TimeoutError => e
|
||||
msg = "#{e.class.name}: #{e.message}"
|
||||
|
@ -11,7 +11,7 @@ module OBSWS
|
||||
end
|
||||
|
||||
def patch
|
||||
7
|
||||
8
|
||||
end
|
||||
|
||||
def to_a
|
||||
|
@ -9,13 +9,21 @@ class OBSWSConnectionErrorTest < Minitest::Test
|
||||
assert_equal("Timed out waiting for successful identification (0.1 seconds elapsed)", e.message)
|
||||
end
|
||||
|
||||
def test_it_raises_an_obsws_connection_error_on_auth_enabled_but_no_password_provided
|
||||
def test_it_raises_an_obsws_connection_error_on_auth_enabled_but_no_password_provided_for_request_client
|
||||
e = assert_raises(OBSWS::OBSWSConnectionError) do
|
||||
OBSWS::Requests::Client
|
||||
.new(host: "localhost", port: 4455, password: "")
|
||||
end
|
||||
assert_equal("auth enabled but no password provided", e.message)
|
||||
end
|
||||
|
||||
def test_it_raises_an_obsws_connection_error_on_auth_enabled_but_no_password_provided_for_event_client
|
||||
e = assert_raises(OBSWS::OBSWSConnectionError) do
|
||||
OBSWS::Events::Client
|
||||
.new(host: "localhost", port: 4455, password: "")
|
||||
end
|
||||
assert_equal("auth enabled but no password provided", e.message)
|
||||
end
|
||||
end
|
||||
|
||||
class OBSWSRequestErrorTest < Minitest::Test
|
||||
|
Loading…
Reference in New Issue
Block a user