Add the error response type to the library

This commit is contained in:
Nick Thomas
2011-11-13 20:09:55 +00:00
parent d96239dd65
commit 3f8b74005d
4 changed files with 61 additions and 1 deletions

View File

@@ -24,6 +24,13 @@ module TestQMPClient
}}
GREETING_TXT = GREETING_HSH.to_json
ERROR_MSG = Messages::Error.new('00000001', 'foo_kls', {}, 'foodesc')
ERROR_HSH = { 'id' => '00000001', 'error' => {
'class' => 'foo_kls', 'data' => {}, 'desc' => 'foodesc'
}
}
ERROR_TXT = ERROR_HSH.to_json
ETIME = Time.now
EVENT_MSG = Messages::Event.new('foo', ETIME, {'a' => 'b'})
EVENT_HSH = {
@@ -50,6 +57,7 @@ module TestQMPClient
[
[Messages::Command, COMMAND_MSG, COMMAND_HSH, COMMAND_TXT],
[Messages::Greeting, GREETING_MSG, GREETING_HSH, GREETING_TXT],
[Messages::Error, ERROR_MSG, ERROR_HSH, ERROR_TXT],
[Messages::Event, EVENT_MSG, EVENT_HSH, EVENT_TXT],
[Messages::Query, QUERY_MSG, QUERY_HSH, QUERY_TXT],
[Messages::Reply, REPLY_MSG, REPLY_HSH, REPLY_TXT]

View File

@@ -16,7 +16,9 @@ module TestQMPClient
assert(defined?(::QMPClient::Messages::Query), "Query message not defined")
assert(defined?(::QMPClient::Messages::Command), "Command message not defined")
assert(defined?(::QMPClient::Messages::Event), "Event message not defined")
assert(defined?(::QMPClient::Messages::Reply), "Greeting message not defined")
assert(defined?(::QMPClient::Messages::Error), "Error message not defined")
assert(defined?(::QMPClient::Messages::Greeting), "Greeting message not defined")
assert(defined?(::QMPClient::Messages::Reply), "Reply message not defined")
end
def expects_socket_run(rio, wio=nil)