]> git.openstreetmap.org Git - rails.git/blob - test/functional/amf_controller_test.rb
Update Potlatch 2 to 2.3-236-ge27f26d build
[rails.git] / test / functional / amf_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'stringio'
3 include Potlatch
4
5 class AmfControllerTest < ActionController::TestCase
6   api_fixtures
7
8   ##
9   # test all routes which lead to this controller
10   def test_routes
11     assert_routing(
12       { :path => "/api/0.6/amf/read", :method => :post },
13       { :controller => "amf", :action => "amf_read" }
14     )
15     assert_routing(
16       { :path => "/api/0.6/amf/write", :method => :post },
17       { :controller => "amf", :action => "amf_write" }
18     )
19   end
20
21   def test_getway
22     # check a visible way
23     id = current_ways(:visible_way).id
24     amf_content "getway", "/1", [id]
25     post :amf_read
26     assert_response :success
27     amf_parse_response                                         
28     way = amf_result("/1")
29     assert_equal way[0], 0
30     assert_equal way[2], id
31   end
32
33   def test_getway_invisible
34     # check an invisible way
35     id = current_ways(:invisible_way).id
36     amf_content "getway", "/1", [id]
37     post :amf_read
38     assert_response :success
39     amf_parse_response
40     way = amf_result("/1")
41     assert_equal way[0], -4
42     assert_equal way[1], "way"
43     assert_equal way[2], id
44     assert way[3].nil? and way[4].nil?
45   end
46
47   def test_getway_nonexistent
48     # check chat a non-existent way is not returned
49     amf_content "getway", "/1", [0]
50     post :amf_read
51     assert_response :success
52     amf_parse_response
53     way = amf_result("/1")
54     assert_equal way[0], -4
55     assert_equal way[1], "way"
56     assert_equal way[2], 0
57     assert way[3].nil? and way[4].nil?
58   end
59
60   def test_whichways
61     node = current_nodes(:used_node_1)
62     minlon = node.lon-0.1
63     minlat = node.lat-0.1
64     maxlon = node.lon+0.1
65     maxlat = node.lat+0.1
66     amf_content "whichways", "/1", [minlon, minlat, maxlon, maxlat]
67     post :amf_read
68     assert_response :success
69     amf_parse_response 
70
71     # check contents of message
72     map = amf_result "/1"
73     assert_equal 0, map[0], 'map error code should be 0'
74     assert_equal "", map[1], 'map error text should be empty'
75
76     # check the formatting of the message
77     assert_equal 5, map.length, 'map should have length 5'
78     assert_equal Array, map[2].class, 'map "ways" element should be an array'
79     assert_equal Array, map[3].class, 'map "nodes" element should be an array'
80     assert_equal Array, map[4].class, 'map "relations" element should be an array'
81     map[2].each do |w|
82       assert_equal 2, w.length, 'way should be (id, version) pair'
83       assert w[0] == w[0].floor, 'way ID should be an integer'
84       assert w[1] == w[1].floor, 'way version should be an integer'
85     end
86
87     map[3].each do |n|
88       assert_equal 5, w.length, 'node should be (id, lat, lon, [tags], version) tuple'
89       assert n[0] == n[0].floor, 'node ID should be an integer'
90       assert n[1] >= minlat - 0.01, 'node lat should be greater than min'
91       assert n[1] <= maxlat - 0.01, 'node lat should be less than max'
92       assert n[2] >= minlon - 0.01, 'node lon should be greater than min'
93       assert n[2] <= maxlon - 0.01, 'node lon should be less than max'
94       assert_equal Array, a[3].class, 'node tags should be array'
95       assert n[4] == n[4].floor, 'node version should be an integer'
96     end
97
98     map[4].each do |r|
99       assert_equal 2, r.length, 'relation should be (id, version) pair'
100       assert r[0] == r[0].floor, 'relation ID should be an integer'
101       assert r[1] == r[1].floor, 'relation version should be an integer'
102     end
103
104     # TODO: looks like amf_controller changed since this test was written
105     # so someone who knows what they're doing should check this!
106     ways = map[2].collect { |x| x[0] }
107     assert ways.include?(current_ways(:used_way).id),
108       "map should include used way"
109     assert !ways.include?(current_ways(:invisible_way).id),
110       'map should not include deleted way'
111   end
112
113   ##
114   # checks that too-large a bounding box will not be served.
115   def test_whichways_toobig
116     bbox = [-0.1,-0.1,1.1,1.1]
117     check_bboxes_are_bad [bbox] do |map,bbox|
118       assert_boundary_error map, " The server said: The maximum bbox size is 0.25, and your request was too large. Either request a smaller area, or use planet.osm"
119     end
120   end
121
122   ##
123   # checks that an invalid bounding box will not be served. in this case
124   # one with max < min latitudes.
125   #
126   # NOTE: the controller expands the bbox by 0.01 in each direction!
127   def test_whichways_badlat
128     bboxes = [[0,0.1,0.1,0], [-0.1,80,0.1,70], [0.24,54.35,0.25,54.33]]
129     check_bboxes_are_bad bboxes do |map, bbox|
130       assert_boundary_error map, " The server said: The minimum latitude must be less than the maximum latitude, but it wasn't", bbox.inspect
131     end
132   end
133
134   ##
135   # same as test_whichways_badlat, but for longitudes
136   #
137   # NOTE: the controller expands the bbox by 0.01 in each direction!
138   def test_whichways_badlon
139     bboxes = [[80,-0.1,70,0.1], [54.35,0.24,54.33,0.25]]
140     check_bboxes_are_bad bboxes do |map, bbox|
141       assert_boundary_error map, " The server said: The minimum longitude must be less than the maximum longitude, but it wasn't", bbox.inspect
142     end
143   end
144
145   def test_whichways_deleted
146     node = current_nodes(:used_node_1)
147     minlon = node.lon-0.1
148     minlat = node.lat-0.1
149     maxlon = node.lon+0.1
150     maxlat = node.lat+0.1
151     amf_content "whichways_deleted", "/1", [minlon, minlat, maxlon, maxlat]
152     post :amf_read
153     assert_response :success
154     amf_parse_response
155
156     # check contents of message
157     map = amf_result "/1"
158     assert_equal 0, map[0], 'first map element should be 0'
159     assert_equal "", map[1], 'second map element should be an empty string'
160     assert_equal Array, map[2].class, 'third map element should be an array'
161     # TODO: looks like amf_controller changed since this test was written
162     # so someone who knows what they're doing should check this!
163     assert !map[2].include?(current_ways(:used_way).id),
164       "map should not include used way"
165     assert map[2].include?(current_ways(:invisible_way).id),
166       'map should include deleted way'
167   end
168
169   def test_whichways_deleted_toobig
170     bbox = [-0.1,-0.1,1.1,1.1]
171     amf_content "whichways_deleted", "/1", bbox
172     post :amf_read
173     assert_response :success
174     amf_parse_response 
175
176     map = amf_result "/1"
177     assert_deleted_boundary_error map, " The server said: The maximum bbox size is 0.25, and your request was too large. Either request a smaller area, or use planet.osm"
178   end
179
180   def test_getrelation
181     id = current_relations(:visible_relation).id
182     amf_content "getrelation", "/1", [id]
183     post :amf_read
184     assert_response :success
185     amf_parse_response
186     rel = amf_result("/1")
187     assert_equal rel[0], 0
188     assert_equal rel[2], id
189   end
190
191   def test_getrelation_invisible
192     id = current_relations(:invisible_relation).id
193     amf_content "getrelation", "/1", [id]
194     post :amf_read
195     assert_response :success
196     amf_parse_response
197     rel = amf_result("/1")
198     assert_equal rel[0], -4
199     assert_equal rel[1], "relation"
200     assert_equal rel[2], id
201     assert rel[3].nil? and rel[4].nil?
202   end
203
204   def test_getrelation_nonexistent
205     id = 0
206     amf_content "getrelation", "/1", [id]
207     post :amf_read
208     assert_response :success
209     amf_parse_response
210     rel = amf_result("/1")
211     assert_equal rel[0], -4
212     assert_equal rel[1], "relation"
213     assert_equal rel[2], id
214     assert rel[3].nil? and rel[4].nil?
215   end
216
217   def test_getway_old
218     # try to get the last visible version (specified by <0) (should be current version)
219     latest = current_ways(:way_with_versions)
220     # NOTE: looks from the API changes that this now expects a timestamp
221     # instead of a version number...
222     # try to get version 1
223     v1 = ways(:way_with_versions_v1)
224     { latest.id => '', 
225       v1.way_id => v1.timestamp.strftime("%d %b %Y, %H:%M:%S")
226     }.each do |id, t|
227       amf_content "getway_old", "/1", [id, t]
228       post :amf_read      
229       assert_response :success
230       amf_parse_response
231       returned_way = amf_result("/1")
232       assert_equal 0, returned_way[0]
233       assert_equal id, returned_way[2]
234       # API returns the *latest* version, even for old ways...
235       assert_equal latest.version, returned_way[5]
236     end
237   end
238   
239   ##
240   # test that the server doesn't fall over when rubbish is passed
241   # into the method args.
242   def test_getway_old_invalid
243     way_id = current_ways(:way_with_versions).id
244     { "foo"  => "bar",
245       way_id => "not a date",
246       way_id => "2009-03-25 00:00:00", # <- wrong format
247       way_id => "0 Jan 2009 00:00:00", # <- invalid date
248       -1     => "1 Jan 2009 00:00:00"  # <- invalid ID
249     }.each do |id, t|
250       amf_content "getway_old", "/1", [id, t]
251       post :amf_read
252       assert_response :success
253       amf_parse_response
254       returned_way = amf_result("/1")
255       assert_equal -1, returned_way[0]
256       assert returned_way[3].nil?
257       assert returned_way[4].nil?
258       assert returned_way[5].nil?
259     end
260   end
261
262   def test_getway_old_nonexistent
263     # try to get the last version+10 (shoudn't exist)
264     v1 = ways(:way_with_versions_v1)
265     # try to get last visible version of non-existent way
266     # try to get specific version of non-existent way
267     [[0, ''], 
268      [0, '1 Jan 1970, 00:00:00'], 
269      [v1.way_id, (v1.timestamp - 10).strftime("%d %b %Y, %H:%M:%S")]
270     ].each do |id, t|
271       amf_content "getway_old", "/1", [id, t]
272       post :amf_read
273       assert_response :success
274       amf_parse_response
275       returned_way = amf_result("/1")
276       assert_equal -1, returned_way[0]
277       assert returned_way[3].nil?
278       assert returned_way[4].nil?
279       assert returned_way[5].nil?
280     end
281   end
282
283   def test_getway_history
284     latest = current_ways(:way_with_versions)
285     oldest = ways(:way_with_versions_v1)
286
287     amf_content "getway_history", "/1", [latest.id]
288     post :amf_read
289     assert_response :success
290     amf_parse_response
291     history = amf_result("/1")
292
293     # ['way',wayid,history]
294     assert_equal 'way', history[0]
295     assert_equal latest.id, history[1] 
296     # We use dates rather than version numbers here, because you might
297     # have moved a node within a way (i.e. way version not incremented).
298     # The timestamp is +1 (timestamp.succ) because we say "give me the
299     # revision of 15:33:02", but that might actually include changes at
300     # 15:33:02.457.
301     assert_equal latest.timestamp.succ.strftime("%d %b %Y, %H:%M:%S"), history[2].first[0]
302     assert_equal oldest.timestamp.succ.strftime("%d %b %Y, %H:%M:%S"), history[2].last[0]
303   end
304
305   def test_getway_history_nonexistent
306     amf_content "getway_history", "/1", [0]
307     post :amf_read
308     assert_response :success
309     amf_parse_response
310     history = amf_result("/1")
311
312     # ['way',wayid,history]
313     assert_equal history[0], 'way'
314     assert_equal history[1], 0
315     assert history[2].empty?
316   end
317
318   def test_getnode_history
319     latest = current_nodes(:node_with_versions)
320     amf_content "getnode_history", "/1", [latest.id]
321     post :amf_read
322     assert_response :success
323     amf_parse_response
324     history = amf_result("/1")
325
326     # ['node',nodeid,history]
327     # note that (as per getway_history) we actually round up
328     # to the next second
329     assert_equal history[0], 'node', 
330       'first element should be "node"'
331     assert_equal history[1], latest.id,
332       'second element should be the input node ID'
333     assert_equal history[2].first[0], 
334       latest.timestamp.succ.strftime("%d %b %Y, %H:%M:%S"),
335       'first element in third element (array) should be the latest version'
336     assert_equal history[2].last[0], 
337       nodes(:node_with_versions_v1).timestamp.succ.strftime("%d %b %Y, %H:%M:%S"),
338       'last element in third element (array) should be the initial version'
339   end
340
341   def test_getnode_history_nonexistent
342     amf_content "getnode_history", "/1", [0]
343     post :amf_read
344     assert_response :success
345     amf_parse_response
346     history = amf_result("/1")
347
348     # ['node',nodeid,history]
349     assert_equal history[0], 'node'
350     assert_equal history[1], 0
351     assert history[2].empty?
352   end
353
354   # ************************************************************
355   # AMF Write tests
356   def test_putpoi_update_valid
357     nd = current_nodes(:visible_node)
358     cs_id = changesets(:public_user_first_change).id
359     amf_content "putpoi", "/1", ["test@example.com:test", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]
360     post :amf_write
361     assert_response :success
362     amf_parse_response
363     result = amf_result("/1")
364     
365     assert_equal 0, result[0]
366     assert_equal "", result[1]
367     assert_equal nd.id, result[2]
368     assert_equal nd.id, result[3]
369     assert_equal nd.version+1, result[4]
370     
371     # Now try to update again, with a different lat/lon, using the updated version number
372     lat = nd.lat+0.1
373     lon = nd.lon-0.1
374     amf_content "putpoi", "/2", ["test@example.com:test", cs_id, nd.version+1, nd.id, lon, lat, nd.tags, nd.visible]
375     post :amf_write
376     assert_response :success
377     amf_parse_response
378     result = amf_result("/2")
379     
380     assert_equal 0, result[0]
381     assert_equal "", result[1]
382     assert_equal nd.id, result[2]
383     assert_equal nd.id, result[3]
384     assert_equal nd.version+2, result[4]
385   end
386   
387   # Check that we can create a no valid poi
388   # Using similar method for the node controller test
389   def test_putpoi_create_valid
390     # This node has no tags
391     nd = Node.new
392     # create a node with random lat/lon
393     lat = rand(100)-50 + rand
394     lon = rand(100)-50 + rand
395     # normal user has a changeset open
396     changeset = changesets(:public_user_first_change)
397     
398     amf_content "putpoi", "/1", ["test@example.com:test", changeset.id, nil, nil, lon, lat, {}, nil]
399     post :amf_write
400     assert_response :success
401     amf_parse_response
402     result = amf_result("/1")
403     
404     # check the array returned by the amf
405     assert_equal 5, result.size
406     assert_equal 0, result[0], "expected to get the status ok from the amf"
407     assert_equal 0, result[2], "The old id should be 0"
408     assert result[3] > 0, "The new id should be greater than 0"
409     assert_equal 1, result[4], "The new version should be 1"
410     
411     # Finally check that the node that was saved has saved the data correctly 
412     # in both the current and history tables
413     # First check the current table
414     current_node = Node.find(result[3].to_i)
415     assert_in_delta lat, current_node.lat, 0.00001, "The latitude was not retreieved correctly"
416     assert_in_delta lon, current_node.lon, 0.00001, "The longitude was not retreived correctly"
417     assert_equal 0, current_node.tags.size, "There seems to be a tag that has been added to the node"
418     assert_equal result[4], current_node.version, "The version returned, is different to the one returned by the amf"
419     # Now check the history table
420     historic_nodes = Node.find(:all, :conditions => { :id => result[3] })
421     assert_equal 1, historic_nodes.size, "There should only be one historic node created"
422     first_historic_node = historic_nodes.first
423     assert_in_delta lat, first_historic_node.lat, 0.00001, "The latitude was not retreived correctly"
424     assert_in_delta lon, first_historic_node.lon, 0.00001, "The longitude was not retreuved correctly"
425     assert_equal 0, first_historic_node.tags.size, "There seems to be a tag that have been attached to this node"
426     assert_equal result[4], first_historic_node.version, "The version returned, is different to the one returned by the amf"
427     
428     ####
429     # This node has some tags
430     tnd = Node.new
431     # create a node with random lat/lon
432     lat = rand(100)-50 + rand
433     lon = rand(100)-50 + rand
434     # normal user has a changeset open
435     changeset = changesets(:public_user_first_change)
436     
437     amf_content "putpoi", "/2", ["test@example.com:test", changeset.id, nil, nil, lon, lat, { "key" => "value", "ping" => "pong" }, nil]
438     post :amf_write
439     assert_response :success
440     amf_parse_response
441     result = amf_result("/2")
442
443     # check the array returned by the amf
444     assert_equal 5, result.size
445     assert_equal 0, result[0], "Expected to get the status ok in the amf"
446     assert_equal 0, result[2], "The old id should be 0"
447     assert result[3] > 0, "The new id should be greater than 0"
448     assert_equal 1, result[4], "The new version should be 1"
449     
450     # Finally check that the node that was saved has saved the data correctly 
451     # in both the current and history tables
452     # First check the current table
453     current_node = Node.find(result[3].to_i)
454     assert_in_delta lat, current_node.lat, 0.00001, "The latitude was not retreieved correctly"
455     assert_in_delta lon, current_node.lon, 0.00001, "The longitude was not retreived correctly"
456     assert_equal 2, current_node.tags.size, "There seems to be a tag that has been added to the node"
457     assert_equal({ "key" => "value", "ping" => "pong" }, current_node.tags, "tags are different")
458     assert_equal result[4], current_node.version, "The version returned, is different to the one returned by the amf"
459     # Now check the history table
460     historic_nodes = Node.find(:all, :conditions => { :id => result[3] })
461     assert_equal 1, historic_nodes.size, "There should only be one historic node created"
462     first_historic_node = historic_nodes.first
463     assert_in_delta lat, first_historic_node.lat, 0.00001, "The latitude was not retreived correctly"
464     assert_in_delta lon, first_historic_node.lon, 0.00001, "The longitude was not retreuved correctly"
465     assert_equal 2, first_historic_node.tags.size, "There seems to be a tag that have been attached to this node"
466     assert_equal({ "key" => "value", "ping" => "pong" }, first_historic_node.tags, "tags are different")
467     assert_equal result[4], first_historic_node.version, "The version returned, is different to the one returned by the amf"
468   end
469   
470   # try creating a POI with rubbish in the tags
471   def test_putpoi_create_with_control_chars
472     # This node has no tags
473     nd = Node.new
474     # create a node with random lat/lon
475     lat = rand(100)-50 + rand
476     lon = rand(100)-50 + rand
477     # normal user has a changeset open
478     changeset = changesets(:public_user_first_change)
479     
480     mostly_invalid = (0..31).to_a.map {|i| i.chr}.join
481     tags = { "something" => "foo#{mostly_invalid}bar" }
482       
483     amf_content "putpoi", "/1", ["test@example.com:test", changeset.id, nil, nil, lon, lat, tags, nil]
484     post :amf_write
485     assert_response :success
486     amf_parse_response
487     result = amf_result("/1")
488       
489     # check the array returned by the amf
490     assert_equal 5, result.size
491     assert_equal 0, result[0], "Expected to get the status ok in the amf"
492     assert_equal 0, result[2], "The old id should be 0"
493     assert result[3] > 0, "The new id should be greater than 0"
494     assert_equal 1, result[4], "The new version should be 1"
495     
496     # Finally check that the node that was saved has saved the data correctly 
497     # in both the current and history tables
498     # First check the current table
499     current_node = Node.find(result[3].to_i)
500     assert_equal 1, current_node.tags.size, "There seems to be a tag that has been added to the node"
501     assert_equal({ "something" => "foo\t\n\rbar" }, current_node.tags, "tags were not fixed correctly")
502     assert_equal result[4], current_node.version, "The version returned, is different to the one returned by the amf"
503   end
504
505   # try creating a POI with rubbish in the tags
506   def test_putpoi_create_with_invalid_utf8
507     # This node has no tags
508     nd = Node.new
509     # create a node with random lat/lon
510     lat = rand(100)-50 + rand
511     lon = rand(100)-50 + rand
512     # normal user has a changeset open
513     changeset = changesets(:public_user_first_change)
514     
515     invalid = "\xc0\xc0"
516     tags = { "something" => "foo#{invalid}bar" }
517       
518     amf_content "putpoi", "/1", ["test@example.com:test", changeset.id, nil, nil, lon, lat, tags, nil]
519     post :amf_write
520     assert_response :success
521     amf_parse_response
522     result = amf_result("/1")
523
524     assert_equal 2, result.size
525     assert_equal -1, result[0], "Expected to get the status FAIL in the amf"
526     assert_equal "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1.", result[1] 
527   end
528       
529   def test_putpoi_delete_valid
530     
531   end
532   
533   def test_putpoi_delete_already_deleted
534     
535   end
536   
537   def test_putpoi_delete_not_found
538     
539   end
540   
541   def test_putpoi_invalid_latlon
542     
543   end
544
545   def test_startchangeset_invalid_xmlchar_comment
546     invalid = "\035\022"
547     comment = "foo#{invalid}bar"
548       
549     amf_content "startchangeset", "/1", ["test@example.com:test", Hash.new, nil, comment, 1]
550     post :amf_write
551     assert_response :success
552     amf_parse_response
553     result = amf_result("/1")
554
555     assert_equal 3, result.size, result.inspect
556     assert_equal 0, result[0]
557     new_cs_id = result[2].to_i
558
559     cs = Changeset.find(new_cs_id)
560     assert_equal "foobar", cs.tags["comment"]
561   end
562
563   # ************************************************************
564   # AMF Helper functions
565
566   # Get the result record for the specified ID
567   # It's an assertion FAIL if the record does not exist
568   def amf_result ref
569     assert @amf_result.has_key?("#{ref}/onResult")
570     @amf_result["#{ref}/onResult"]
571   end
572
573   # Encode the AMF message to invoke "target" with parameters as
574   # the passed data. The ref is used to retrieve the results.
575   def amf_content(target, ref, data)
576     a,b=1.divmod(256)
577     c = StringIO.new()
578     c.write 0.chr+0.chr   # version 0
579     c.write 0.chr+0.chr   # n headers
580     c.write a.chr+b.chr   # n bodies
581     c.write AMF.encodestring(target)
582     c.write AMF.encodestring(ref)
583     c.write [-1].pack("N")
584     c.write AMF.encodevalue(data)
585
586     @request.env["RAW_POST_DATA"] = c.string
587   end
588
589   # Parses the @response object as an AMF messsage.
590   # The result is a hash of message_ref => data.
591   # The attribute @amf_result is initialised to this hash.
592   def amf_parse_response
593     req = StringIO.new(@response.body)
594
595     req.read(2)   # version
596
597     # parse through any headers
598         headers=AMF.getint(req)                                 # Read number of headers
599         headers.times do                                                # Read each header
600           name=AMF.getstring(req)                               #  |
601           req.getc                                                              #  | skip boolean
602           value=AMF.getvalue(req)                               #  |
603         end
604
605     # parse through responses
606     results = {}
607     bodies=AMF.getint(req)                                      # Read number of bodies
608         bodies.times do                                                 # Read each body
609           message=AMF.getstring(req)                    #  | get message name
610           index=AMF.getstring(req)                              #  | get index in response sequence
611           bytes=AMF.getlong(req)                                #  | get total size in bytes
612           args=AMF.getvalue(req)                                #  | get response (probably an array)
613       results[message] = args
614     end
615     @amf_result = results
616     results
617   end
618
619   ##
620   # given an array of bounding boxes (each an array of 4 floats), call the
621   # AMF "whichways" controller for each and pass the result back to the
622   # caller's block for assertion testing.
623   def check_bboxes_are_bad(bboxes)
624     bboxes.each do |bbox|
625       amf_content "whichways", "/1", bbox
626       post :amf_read
627       assert_response :success
628       amf_parse_response
629
630       # pass the response back to the caller's block to be tested
631       # against what the caller expected.
632       map = amf_result "/1"
633       yield map, bbox
634     end
635   end
636   
637   # this should be what AMF controller returns when the bbox of a
638   # whichways request is invalid or too large.
639   def assert_boundary_error(map, msg=nil, error_hint=nil)
640     expected_map = [-2, "Sorry - I can't get the map for that area.#{msg}"]
641     assert_equal expected_map, map, "AMF controller should have returned an error. (#{error_hint})"
642   end
643
644   # this should be what AMF controller returns when the bbox of a
645   # whichways_deleted request is invalid or too large.
646   def assert_deleted_boundary_error(map, msg=nil, error_hint=nil)
647     expected_map = [-2, "Sorry - I can't get the map for that area.#{msg}"]
648     assert_equal expected_map, map, "AMF controller should have returned an error. (#{error_hint})"
649   end
650 end