mirror of
https://github.com/onyx-and-iris/obsws-ruby.git
synced 2024-11-15 18:50: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"
|
require_relative "../lib/obsws"
|
||||||
|
|
||||||
class OBSWSTest < Minitest::Test
|
class OBSWSTest < Minitest::Test
|
||||||
|
class << self
|
||||||
|
attr_reader :r_client
|
||||||
|
end
|
||||||
|
|
||||||
def self.before_run
|
def self.before_run
|
||||||
conn = YAML.load_file("obs.yml", symbolize_names: true)[:connection]
|
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("START_TEST")
|
||||||
@@r_client.create_scene("BRB_TEST")
|
r_client.create_scene("BRB_TEST")
|
||||||
@@r_client.create_scene("END_TEST")
|
r_client.create_scene("END_TEST")
|
||||||
end
|
end
|
||||||
|
|
||||||
before_run
|
before_run
|
||||||
@ -23,9 +27,9 @@ class OBSWSTest < Minitest::Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
Minitest.after_run do
|
Minitest.after_run do
|
||||||
@@r_client.remove_scene("START_TEST")
|
r_client.remove_scene("START_TEST")
|
||||||
@@r_client.remove_scene("BRB_TEST")
|
r_client.remove_scene("BRB_TEST")
|
||||||
@@r_client.remove_scene("END_TEST")
|
r_client.remove_scene("END_TEST")
|
||||||
@@r_client.close
|
r_client.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,7 @@ require_relative "../minitest_helper"
|
|||||||
|
|
||||||
class AttrsTest < OBSWSTest
|
class AttrsTest < OBSWSTest
|
||||||
def test_get_version_attrs
|
def test_get_version_attrs
|
||||||
resp = @@r_client.get_version
|
resp = OBSWSTest.r_client.get_version
|
||||||
assert resp.attrs ==
|
assert resp.attrs ==
|
||||||
%w[
|
%w[
|
||||||
available_requests
|
available_requests
|
||||||
|
@ -2,21 +2,21 @@ require_relative "../minitest_helper"
|
|||||||
|
|
||||||
class RequestTest < OBSWSTest
|
class RequestTest < OBSWSTest
|
||||||
def test_it_checks_obs_major_version
|
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)
|
ver = resp.obs_version.split(".").map(&:to_i)
|
||||||
assert ver[0] >= 28
|
assert ver[0] >= 28
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_it_checks_ws_major_version
|
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)
|
ver = resp.obs_web_socket_version.split(".").map(&:to_i)
|
||||||
assert ver[0] >= 5
|
assert ver[0] >= 5
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_it_sets_and_gets_current_program_scene
|
def test_it_sets_and_gets_current_program_scene
|
||||||
%w[START_TEST BRB_TEST END_TEST].each do |s|
|
%w[START_TEST BRB_TEST END_TEST].each do |s|
|
||||||
@@r_client.set_current_program_scene(s)
|
OBSWSTest.r_client.set_current_program_scene(s)
|
||||||
resp = @@r_client.get_current_program_scene
|
resp = OBSWSTest.r_client.get_current_program_scene
|
||||||
assert resp.current_program_scene_name == s
|
assert resp.current_program_scene_name == s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -26,8 +26,8 @@ class RequestTest < OBSWSTest
|
|||||||
server: "rtmp://addressofrtmpserver",
|
server: "rtmp://addressofrtmpserver",
|
||||||
key: "live_myvery_secretkey"
|
key: "live_myvery_secretkey"
|
||||||
}
|
}
|
||||||
@@r_client.set_stream_service_settings("rtmp_common", settings)
|
OBSWSTest.r_client.set_stream_service_settings("rtmp_common", settings)
|
||||||
resp = @@r_client.get_stream_service_settings
|
resp = OBSWSTest.r_client.get_stream_service_settings
|
||||||
assert resp.stream_service_type == "rtmp_common"
|
assert resp.stream_service_type == "rtmp_common"
|
||||||
assert resp.stream_service_settings ==
|
assert resp.stream_service_settings ==
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user