relation_id: 4
k: 'tag4'
v: 'val4'
+
+rv_t1:
+ relation_id: 8
+ k: 'testing'
+ v: 'added in relation version 3'
+
+rv_t2:
+ relation_id: 8
+ k: 'testing two'
+ v: 'modified in relation version 4'
k: 'test'
v: 'yes'
+wv_t1:
+ way_id: 4
+ k: 'testing'
+ v: 'added in way version 3'
+
+wv_t2:
+ way_id: 4
+ k: 'testing two'
+ v: 'modified in way version 4'
k: 'tag4'
v: 'val4'
version: 1
+
+rv3_t1:
+ relation_id: 8
+ k: 'testing'
+ v: 'added in relation version 3'
+ version: 3
+
+rv3_t2:
+ relation_id: 8
+ k: 'testing two'
+ v: 'added in relation version 3'
+ version: 3
+
+rv3_t3:
+ relation_id: 8
+ k: 'testing three'
+ v: 'added in relation version 3'
+ version: 3
+
+rv4_t1:
+ relation_id: 8
+ k: 'testing'
+ v: 'added in relation version 3'
+ version: 4
+
+rv4_t2:
+ relation_id: 8
+ k: 'testing two'
+ v: 'modified in relation version 4'
+ version: 4
v: 'yes'
version: 1
+wv3_t1:
+ way_id: 4
+ k: 'testing'
+ v: 'added in way version 3'
+ version: 3
+
+wv3_t2:
+ way_id: 4
+ k: 'testing two'
+ v: 'added in way version 3'
+ version: 3
+
+wv3_t3:
+ way_id: 4
+ k: 'testing three'
+ v: 'added in way version 3'
+ version: 3
+
+wv4_t1:
+ way_id: 4
+ k: 'testing'
+ v: 'added in way version 3'
+ version: 4
+
+wv4_t2:
+ way_id: 4
+ k: 'testing two'
+ v: 'modified in way version 4'
+ version: 4
+
t6_v1:
way_id: 6
k: 'test'
}
assert_equal "Element node/23 has duplicate tags with key dup", message_update.message
end
+
+ def test_node_tags
+ node = current_nodes(:node_with_versions)
+ tags = Node.find(node.id).node_tags.order(:k)
+ assert_equal 2, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in node version 3", tags[0].v
+ assert_equal "testing two", tags[1].k
+ assert_equal "modified in node version 4", tags[1].v
+ end
+
+ def test_tags
+ node = current_nodes(:node_with_versions)
+ tags = Node.find(node.id).tags
+ assert_equal 2, tags.size
+ assert_equal "added in node version 3", tags["testing"]
+ assert_equal "modified in node version 4", tags["testing two"]
+ end
end
class OldNodeTest < ActiveSupport::TestCase
api_fixtures
- def test_old_node_count
+ def test_node_count
assert_equal 21, OldNode.count
end
#assert_equal node.tile, QuadTile.tile_for_point(nodes(nod).lat, nodes(nod).lon)
assert_equal false, node.valid?
end
+
+ def test_node_tags
+ node = nodes(:node_with_versions_v1)
+ tags = OldNode.find(node.id).old_tags.order(:k)
+ assert_equal 0, tags.count
+
+ node = nodes(:node_with_versions_v2)
+ tags = OldNode.find(node.id).old_tags.order(:k)
+ assert_equal 0, tags.count
+
+ node = nodes(:node_with_versions_v3)
+ tags = OldNode.find(node.id).old_tags.order(:k)
+ assert_equal 3, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in node version 3", tags[0].v
+ assert_equal "testing three", tags[1].k
+ assert_equal "added in node version 3", tags[1].v
+ assert_equal "testing two", tags[2].k
+ assert_equal "added in node version 3", tags[2].v
+
+ node = nodes(:node_with_versions_v4)
+ tags = OldNode.find(node.id).old_tags.order(:k)
+ assert_equal 2, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in node version 3", tags[0].v
+ assert_equal "testing two", tags[1].k
+ assert_equal "modified in node version 4", tags[1].v
+ end
+
+ def test_tags
+ node = nodes(:node_with_versions_v1)
+ tags = OldNode.find(node.id).tags
+ assert_equal 0, tags.size
+
+ node = nodes(:node_with_versions_v2)
+ tags = OldNode.find(node.id).tags
+ assert_equal 0, tags.size
+
+ node = nodes(:node_with_versions_v3)
+ tags = OldNode.find(node.id).tags
+ assert_equal 3, tags.size
+ assert_equal "added in node version 3", tags["testing"]
+ assert_equal "added in node version 3", tags["testing two"]
+ assert_equal "added in node version 3", tags["testing three"]
+
+ node = nodes(:node_with_versions_v4)
+ tags = OldNode.find(node.id).tags
+ assert_equal 2, tags.size
+ assert_equal "added in node version 3", tags["testing"]
+ assert_equal "modified in node version 4", tags["testing two"]
+ end
end
api_fixtures
def test_tag_count
- assert_equal 7, OldRelationTag.count
+ assert_equal 12, OldRelationTag.count
end
def test_length_key_valid
--- /dev/null
+require File.dirname(__FILE__) + '/../test_helper'
+
+class OldRelationTest < ActiveSupport::TestCase
+ api_fixtures
+
+ def test_db_count
+ assert_equal 14, OldRelation.count
+ end
+
+ def test_relation_tags
+ relation = relations(:relation_with_versions_v1)
+ tags = OldRelation.find(relation.id).old_tags.order(:k)
+ assert_equal 0, tags.count
+
+ relation = relations(:relation_with_versions_v2)
+ tags = OldRelation.find(relation.id).old_tags.order(:k)
+ assert_equal 0, tags.count
+
+ relation = relations(:relation_with_versions_v3)
+ tags = OldRelation.find(relation.id).old_tags.order(:k)
+ assert_equal 3, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in relation version 3", tags[0].v
+ assert_equal "testing three", tags[1].k
+ assert_equal "added in relation version 3", tags[1].v
+ assert_equal "testing two", tags[2].k
+ assert_equal "added in relation version 3", tags[2].v
+
+ relation = relations(:relation_with_versions_v4)
+ tags = OldRelation.find(relation.id).old_tags.order(:k)
+ assert_equal 2, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in relation version 3", tags[0].v
+ assert_equal "testing two", tags[1].k
+ assert_equal "modified in relation version 4", tags[1].v
+ end
+
+ def test_tags
+ relation = relations(:relation_with_versions_v1)
+ tags = OldRelation.find(relation.id).tags
+ assert_equal 0, tags.size
+
+ relation = relations(:relation_with_versions_v2)
+ tags = OldRelation.find(relation.id).tags
+ assert_equal 0, tags.size
+
+ relation = relations(:relation_with_versions_v3)
+ tags = OldRelation.find(relation.id).tags
+ assert_equal 3, tags.size
+ assert_equal "added in relation version 3", tags["testing"]
+ assert_equal "added in relation version 3", tags["testing two"]
+ assert_equal "added in relation version 3", tags["testing three"]
+
+ relation = relations(:relation_with_versions_v4)
+ tags = OldRelation.find(relation.id).tags
+ assert_equal 2, tags.size
+ assert_equal "added in relation version 3", tags["testing"]
+ assert_equal "modified in relation version 4", tags["testing two"]
+ end
+end
api_fixtures
def test_tag_count
- assert_equal 7, OldWayTag.count
+ assert_equal 12, OldWayTag.count
end
def test_length_key_valid
--- /dev/null
+require File.dirname(__FILE__) + '/../test_helper'
+
+class OldWayTest < ActiveSupport::TestCase
+ api_fixtures
+
+ def test_db_count
+ assert_equal 12, OldWay.count
+ end
+
+ def test_way_tags
+ way = ways(:way_with_versions_v1)
+ tags = OldWay.find(way.id).old_tags.order(:k)
+ assert_equal 0, tags.count
+
+ way = ways(:way_with_versions_v2)
+ tags = OldWay.find(way.id).old_tags.order(:k)
+ assert_equal 0, tags.count
+
+ way = ways(:way_with_versions_v3)
+ tags = OldWay.find(way.id).old_tags.order(:k)
+ assert_equal 3, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in way version 3", tags[0].v
+ assert_equal "testing three", tags[1].k
+ assert_equal "added in way version 3", tags[1].v
+ assert_equal "testing two", tags[2].k
+ assert_equal "added in way version 3", tags[2].v
+
+ way = ways(:way_with_versions_v4)
+ tags = OldWay.find(way.id).old_tags.order(:k)
+ assert_equal 2, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in way version 3", tags[0].v
+ assert_equal "testing two", tags[1].k
+ assert_equal "modified in way version 4", tags[1].v
+ end
+
+ def test_tags
+ way = ways(:way_with_versions_v1)
+ tags = OldWay.find(way.id).tags
+ assert_equal 0, tags.size
+
+ way = ways(:way_with_versions_v2)
+ tags = OldWay.find(way.id).tags
+ assert_equal 0, tags.size
+
+ way = ways(:way_with_versions_v3)
+ tags = OldWay.find(way.id).tags
+ assert_equal 3, tags.size
+ assert_equal "added in way version 3", tags["testing"]
+ assert_equal "added in way version 3", tags["testing two"]
+ assert_equal "added in way version 3", tags["testing three"]
+
+ way = ways(:way_with_versions_v4)
+ tags = OldWay.find(way.id).tags
+ assert_equal 2, tags.size
+ assert_equal "added in way version 3", tags["testing"]
+ assert_equal "modified in way version 4", tags["testing two"]
+ end
+end
api_fixtures
def test_relation_tag_count
- assert_equal 7, RelationTag.count
+ assert_equal 9, RelationTag.count
end
def test_length_key_valid
}
assert_equal "Element relation/23 has duplicate tags with key dup", message_update.message
end
+
+ def test_relation_tags
+ relation = current_relations(:relation_with_versions)
+ tags = Relation.find(relation.id).relation_tags.order(:k)
+ assert_equal 2, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in relation version 3", tags[0].v
+ assert_equal "testing two", tags[1].k
+ assert_equal "modified in relation version 4", tags[1].v
+ end
+
+ def test_tags
+ relation = current_relations(:relation_with_versions)
+ tags = Relation.find(relation.id).tags
+ assert_equal 2, tags.size
+ assert_equal "added in relation version 3", tags["testing"]
+ assert_equal "modified in relation version 4", tags["testing two"]
+ end
end
api_fixtures
def test_way_tag_count
- assert_equal 3, WayTag.count
+ assert_equal 5, WayTag.count
end
def test_length_key_valid
}
assert_equal "Element way/23 has duplicate tags with key dup", message_update.message
end
+
+ def test_way_tags
+ way = current_ways(:way_with_versions)
+ tags = Way.find(way.id).way_tags.order(:k)
+ assert_equal 2, tags.count
+ assert_equal "testing", tags[0].k
+ assert_equal "added in way version 3", tags[0].v
+ assert_equal "testing two", tags[1].k
+ assert_equal "modified in way version 4", tags[1].v
+ end
+
+ def test_tags
+ way = current_ways(:way_with_versions)
+ tags = Way.find(way.id).tags
+ assert_equal 2, tags.size
+ assert_equal "added in way version 3", tags["testing"]
+ assert_equal "modified in way version 4", tags["testing two"]
+ end
end