From 1105ec087d673abf0b661885aa721ecbc6897442 Mon Sep 17 00:00:00 2001 From: Heiko Kernbach Date: Thu, 20 Sep 2012 11:36:16 +0200 Subject: [PATCH] added api-statistic unittest --- .../HttpInterface/api-statistics-spec.rb | 63 +++++++++++++++++++ UnitTests/HttpInterface/run-tests | 1 + 2 files changed, 64 insertions(+) create mode 100644 UnitTests/HttpInterface/api-statistics-spec.rb diff --git a/UnitTests/HttpInterface/api-statistics-spec.rb b/UnitTests/HttpInterface/api-statistics-spec.rb new file mode 100644 index 0000000000..cd409e00de --- /dev/null +++ b/UnitTests/HttpInterface/api-statistics-spec.rb @@ -0,0 +1,63 @@ +# coding: utf-8 + +require 'rspec' +require './arangodb.rb' + +describe ArangoDB do + api = "/_admin/" + prefix = "admin-statistics" + context "calculating statistics:" do + + +################################################################################ +## check requests-statistics availability +############################################################################### + + it "testing requests-statistics correct cmd" do + cmd = "/_admin/request-statistics" + doc = ArangoDB.log_post("#{prefix}", cmd) + + doc.code.should eq(200) + end + +################################################################################ +## check requests-statistics for wrong user interaction +############################################################################### + + it "testing requests-statistics wrong cmd" do + cmd = "/_admin/request-statistics/asd123" + doc = ArangoDB.log_post("#{prefix}", cmd) + + doc.code.should eq(501) + doc.parsed_response['error'].should eq(true) + doc.parsed_response['errorNum'].should eq(9) + end + +################################################################################ +## check requests-statistics availability +############################################################################### + + it "testing connection-statistics correct cmd" do + cmd = "/_admin/connection-statistics" + doc = ArangoDB.log_post("#{prefix}", cmd) + + doc.code.should eq(200) + end + +################################################################################ +## check requests-connection for wrong user interaction +############################################################################### + + it "testing connection-statistics wrong cmd" do + cmd = "/_admin/connection-statistics/asd123" + doc = ArangoDB.log_post("#{prefix}", cmd) + + doc.code.should eq(501) + doc.parsed_response['error'].should eq(true) + doc.parsed_response['errorNum'].should eq(9) + end + + + end +end + diff --git a/UnitTests/HttpInterface/run-tests b/UnitTests/HttpInterface/run-tests index 55d4c19814..bb6819e895 100755 --- a/UnitTests/HttpInterface/run-tests +++ b/UnitTests/HttpInterface/run-tests @@ -16,4 +16,5 @@ rspec --format d \ api-index-skiplist-spec.rb \ api-explain-spec.rb \ api-cursor-spec.rb \ + api-statistics-spec.rb \ api-simple-spec.rb