ts3query 0.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,19 +6,19 @@ Feature: Run a query command
|
|
6
6
|
Scenario: Run 'version' command
|
7
7
|
Given I am connected to the default server with the password 0L8awVFD
|
8
8
|
When I run the command version
|
9
|
-
Then I should get a hash with version=3.0.5 build=1335156372 platform=Linux
|
9
|
+
Then I should get a hash with version=3.0.5 build=1335156372 platform=Linux
|
10
10
|
|
11
11
|
Scenario: Run 'serverlist' command with options
|
12
12
|
Given I am connected to the default server with the password 0L8awVFD
|
13
13
|
When I run the command serverlist with the options -uid -short
|
14
|
-
Then I should get a hash with virtualserver_id=1 virtualserver_port=9987 virtualserver_status=online
|
14
|
+
Then I should get a hash with virtualserver_id=1 virtualserver_port=9987 virtualserver_status=online
|
15
15
|
|
16
16
|
Scenario: Run 'use' command with parameters
|
17
17
|
Given I am connected to the default server with the password 0L8awVFD
|
18
18
|
When I run the command use with the parameters sid=1
|
19
|
-
Then I should get a hash
|
19
|
+
Then I should get a hash
|
20
20
|
|
21
21
|
Scenario: Run 'use' command with options and parameters
|
22
22
|
Given I am connected to the default server with the password 0L8awVFD
|
23
23
|
When I run the command use with the options -virtual and the parameters sid=1
|
24
|
-
Then I should get a hash
|
24
|
+
Then I should get a hash
|
@@ -46,10 +46,19 @@ When /^I run the command use with the options (.+) and the parameters (.+)$/ do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
Then /^I should get a hash with (.+)$/ do |data|
|
49
|
+
list = []
|
49
50
|
hash = {}
|
51
|
+
|
50
52
|
data.split(" ").each do |entity|
|
51
53
|
hash[entity.split("=")[0]] = entity.split("=")[1]
|
52
54
|
end
|
55
|
+
list << hash
|
56
|
+
list << {"id" => "0", "msg" => "ok"}
|
53
57
|
|
54
|
-
@result.should eq(
|
58
|
+
@result.should eq(list)
|
55
59
|
end
|
60
|
+
|
61
|
+
Then /^I should get a hash$/ do
|
62
|
+
list = [{"id" => "0", "msg" => "ok"}]
|
63
|
+
@result.should eq(list)
|
64
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -10,7 +10,7 @@ class TS3Connection
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def method_missing(meth, *args, &block)
|
13
|
-
result =
|
13
|
+
result = []
|
14
14
|
options = ""
|
15
15
|
params = ""
|
16
16
|
|
@@ -28,11 +28,14 @@ class TS3Connection
|
|
28
28
|
end
|
29
29
|
|
30
30
|
@connection.cmd("String" => "#{meth}#{params}#{options}\r",
|
31
|
-
"Match" => /error id=0 msg=ok\n/) { |data|
|
31
|
+
"Match" => /error id=0 msg=ok\n/) { |data|
|
32
|
+
current_data = {}
|
32
33
|
data.split(" ").each do |entity|
|
33
|
-
|
34
|
+
current_data[entity.split("=")[0]] = entity.split("=")[1]
|
34
35
|
end
|
35
|
-
|
36
|
+
current_data.delete("error")
|
37
|
+
|
38
|
+
result << current_data
|
36
39
|
}
|
37
40
|
result
|
38
41
|
end
|