mirror of
https://github.com/onyx-and-iris/obsws-ruby.git
synced 2025-01-18 05:20:47 +00:00
add attr_reader r_client for OBSWSTest
This commit is contained in:
parent
af85d8b9ab
commit
856b7b5a5b
@ -5,13 +5,17 @@ require "yaml"
|
||||
require_relative "../lib/obsws"
|
||||
|
||||
class OBSWSTest < Minitest::Test
|
||||
class << self
|
||||
attr_reader :r_client
|
||||
end
|
||||
|
||||
def self.before_run
|
||||
conn = YAML.load_file("obs.yml", symbolize_names: true)[:connection]
|
||||
@@r_client = OBSWS::Requests::Client.new(**conn)
|
||||
@r_client = OBSWS::Requests::Client.new(**conn)
|
||||
|
||||
@@r_client.create_scene("START_TEST")
|
||||
@@r_client.create_scene("BRB_TEST")
|
||||
@@r_client.create_scene("END_TEST")
|
||||
r_client.create_scene("START_TEST")
|
||||
r_client.create_scene("BRB_TEST")
|
||||
r_client.create_scene("END_TEST")
|
||||
end
|
||||
|
||||
before_run
|
||||
@ -23,9 +27,9 @@ class OBSWSTest < Minitest::Test
|
||||
end
|
||||
|
||||
Minitest.after_run do
|
||||
@@r_client.remove_scene("START_TEST")
|
||||
@@r_client.remove_scene("BRB_TEST")
|
||||
@@r_client.remove_scene("END_TEST")
|
||||
@@r_client.close
|
||||
r_client.remove_scene("START_TEST")
|
||||
r_client.remove_scene("BRB_TEST")
|
||||
r_client.remove_scene("END_TEST")
|
||||
r_client.close
|
||||
end
|
||||
end
|
||||
|
@ -2,7 +2,7 @@ require_relative "../minitest_helper"
|
||||
|
||||
class AttrsTest < OBSWSTest
|
||||
def test_get_version_attrs
|
||||
resp = @@r_client.get_version
|
||||
resp = OBSWSTest.r_client.get_version
|
||||
assert resp.attrs ==
|
||||
%w[
|
||||
available_requests
|
||||
|
@ -2,21 +2,21 @@ require_relative "../minitest_helper"
|
||||
|
||||
class RequestTest < OBSWSTest
|
||||
def test_it_checks_obs_major_version
|
||||
resp = @@r_client.get_version
|
||||
resp = OBSWSTest.r_client.get_version
|
||||
ver = resp.obs_version.split(".").map(&:to_i)
|
||||
assert ver[0] >= 28
|
||||
end
|
||||
|
||||
def test_it_checks_ws_major_version
|
||||
resp = @@r_client.get_version
|
||||
resp = OBSWSTest.r_client.get_version
|
||||
ver = resp.obs_web_socket_version.split(".").map(&:to_i)
|
||||
assert ver[0] >= 5
|
||||
end
|
||||
|
||||
def test_it_sets_and_gets_current_program_scene
|
||||
%w[START_TEST BRB_TEST END_TEST].each do |s|
|
||||
@@r_client.set_current_program_scene(s)
|
||||
resp = @@r_client.get_current_program_scene
|
||||
OBSWSTest.r_client.set_current_program_scene(s)
|
||||
resp = OBSWSTest.r_client.get_current_program_scene
|
||||
assert resp.current_program_scene_name == s
|
||||
end
|
||||
end
|
||||
@ -26,8 +26,8 @@ class RequestTest < OBSWSTest
|
||||
server: "rtmp://addressofrtmpserver",
|
||||
key: "live_myvery_secretkey"
|
||||
}
|
||||
@@r_client.set_stream_service_settings("rtmp_common", settings)
|
||||
resp = @@r_client.get_stream_service_settings
|
||||
OBSWSTest.r_client.set_stream_service_settings("rtmp_common", settings)
|
||||
resp = OBSWSTest.r_client.get_stream_service_settings
|
||||
assert resp.stream_service_type == "rtmp_common"
|
||||
assert resp.stream_service_settings ==
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user