]> git.openstreetmap.org Git - rails.git/blob - test/unit/redaction_test.rb
Generate valid URLs for search results with no object attached
[rails.git] / test / unit / redaction_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'osm'
3
4 class RedactionTest < ActiveSupport::TestCase
5   api_fixtures
6   fixtures :redactions
7
8   def test_cannot_redact_current
9     n = current_nodes(:node_with_versions)
10     r = redactions(:example)
11     assert_equal(false, n.redacted?, "Expected node to not be redacted already.")
12     assert_raise(OSM::APICannotRedactError) do
13       n.redact!(r)
14     end
15   end
16
17   def test_cannot_redact_current_via_old
18     n = nodes(:node_with_versions_v4)
19     r = redactions(:example)
20     assert_equal(false, n.redacted?, "Expected node to not be redacted already.")
21     assert_raise(OSM::APICannotRedactError) do
22       n.redact!(r)
23     end
24   end
25
26   def test_can_redact_old
27     n = nodes(:node_with_versions_v3)
28     r = redactions(:example)
29     assert_equal(false, n.redacted?, "Expected node to not be redacted already.")
30     assert_nothing_raised(OSM::APICannotRedactError) do
31       n.redact!(r)
32     end
33     assert_equal(true, n.redacted?, "Expected node to be redacted after redact! call.")
34   end
35
36 end