3 class Arvados::V1::SchemaControllerTest < ActionController::TestCase
8 Rails.cache.delete 'arvados_v1_rest_discovery'
12 test "should get fresh discovery document" do
15 assert_response :success
16 discovery_doc = JSON.parse(@response.body)
17 assert_equal 'discovery#restDescription', discovery_doc['kind']
19 Time.now - MAX_SCHEMA_AGE.seconds < discovery_doc['generatedAt'],
20 "discovery document was generated >#{MAX_SCHEMA_AGE}s ago")
23 test "discovery document has defaultTrashLifetime" do
25 assert_response :success
26 discovery_doc = JSON.parse(@response.body)
27 assert_includes discovery_doc, 'defaultTrashLifetime'
28 assert_equal discovery_doc['defaultTrashLifetime'], Rails.application.config.default_trash_lifetime
31 test "discovery document has source_version" do
33 assert_response :success
34 discovery_doc = JSON.parse(@response.body)
35 assert_match /^[0-9a-f]+(-modified)?$/, discovery_doc['source_version']
38 test "discovery document overrides source_version with config" do
39 Rails.configuration.source_version = 'aaa888fff'
41 assert_response :success
42 discovery_doc = JSON.parse(@response.body)
43 assert_equal 'aaa888fff', discovery_doc['source_version']