Commit 50c6e1f7f83fe9a26db476ed7f60ddf112d209a4
Committed by
Paulo Meireles
1 parent
4c408ea4
Exists in
master
and in
28 other branches
[Mezuro] Removed old tests from not existent clients and entities
Showing
2 changed files
with
0 additions
and
87 deletions
Show diff stats
plugins/mezuro/test/unit/kalibro/client/metric_configuration_client_test.rb
| @@ -1,44 +0,0 @@ | @@ -1,44 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
| 4 | - | ||
| 5 | -class MetricConfigurationClientTest < ActiveSupport::TestCase | ||
| 6 | - | ||
| 7 | - def setup | ||
| 8 | - @port = mock | ||
| 9 | - Kalibro::Client::Port.expects(:new).with('MetricConfiguration').returns(@port) | ||
| 10 | - @client = Kalibro::Client::MetricConfigurationClient.new | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - should 'save metric configuration' do | ||
| 14 | - configuration = MetricConfigurationFixtures.amloc_configuration | ||
| 15 | - @port.expects(:request).with(:save_metric_configuration, { | ||
| 16 | - :metric_configuration => configuration.to_hash, | ||
| 17 | - :configuration_name => 'x' | ||
| 18 | - }) | ||
| 19 | - @client.save(configuration, 'x') | ||
| 20 | - end | ||
| 21 | - | ||
| 22 | - should 'get metric configuration by name' do | ||
| 23 | - configuration = MetricConfigurationFixtures.amloc_configuration | ||
| 24 | - request_body = { | ||
| 25 | - :configuration_name => 'configuration.name', | ||
| 26 | - :metric_name => configuration.metric.name | ||
| 27 | - } | ||
| 28 | - response_hash = {:metric_configuration => configuration.to_hash} | ||
| 29 | - @port.expects(:request).with(:get_metric_configuration, request_body).returns(response_hash) | ||
| 30 | - assert_equal configuration, @client.metric_configuration('configuration.name', configuration.metric.name) | ||
| 31 | - end | ||
| 32 | - | ||
| 33 | - should 'remove metric configuration by name' do | ||
| 34 | - metric_name = 'MetricConfigurationClientTest' | ||
| 35 | - configuration_name = 'xxxx' | ||
| 36 | - request_body = { | ||
| 37 | - :configuration_name => configuration_name, | ||
| 38 | - :metric_name => metric_name | ||
| 39 | - } | ||
| 40 | - @port.expects(:request).with(:remove_metric_configuration, request_body) | ||
| 41 | - @client.remove(configuration_name, metric_name) | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | -end | ||
| 45 | \ No newline at end of file | 0 | \ No newline at end of file |
plugins/mezuro/test/unit/kalibro/entities/metric_configuration_test.rb
| @@ -1,43 +0,0 @@ | @@ -1,43 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" | ||
| 5 | - | ||
| 6 | -class MetricConfigurationTest < ActiveSupport::TestCase | ||
| 7 | - | ||
| 8 | - def setup | ||
| 9 | - @hash = MetricConfigurationFixtures.amloc_configuration_hash | ||
| 10 | - @metric_configuration = MetricConfigurationFixtures.amloc_configuration | ||
| 11 | - @metric_configuration_without_ranges = MetricConfigurationFixtures.metric_configuration_without_ranges | ||
| 12 | - @range1 = RangeFixtures.amloc_excellent | ||
| 13 | - @range2 = RangeFixtures.amloc_bad | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - should 'create metric configuration from hash' do | ||
| 17 | - assert_equal @metric_configuration, Kalibro::Entities::MetricConfiguration.from_hash(@hash) | ||
| 18 | - end | ||
| 19 | - | ||
| 20 | - should 'convert metric configuration to hash' do | ||
| 21 | - assert_equal @hash, @metric_configuration.to_hash | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - should 'create appropriate metric type' do | ||
| 25 | - amloc = MetricConfigurationFixtures.amloc_configuration | ||
| 26 | - sc = MetricConfigurationFixtures.sc_configuration | ||
| 27 | - assert amloc.metric.instance_of?(Kalibro::Entities::NativeMetric) | ||
| 28 | - assert sc.metric.instance_of?(Kalibro::Entities::CompoundMetric) | ||
| 29 | - end | ||
| 30 | - | ||
| 31 | - should 'add a range to an empty range list' do | ||
| 32 | - @metric_configuration_without_ranges.add_range @range1 | ||
| 33 | - assert_equal @metric_configuration_without_ranges.ranges, [@range1] | ||
| 34 | - end | ||
| 35 | - | ||
| 36 | - should 'add a range to an non-empty range list' do | ||
| 37 | - @metric_configuration_without_ranges.ranges = [@range1] | ||
| 38 | - @metric_configuration_without_ranges.add_range @range2 | ||
| 39 | - assert_equal @metric_configuration_without_ranges.ranges, [@range1, @range2] | ||
| 40 | - end | ||
| 41 | - | ||
| 42 | - | ||
| 43 | -end |