@@ -118,6 +118,7 @@ all_tests() -> [
118118 definitions_server_named_queue_test ,
119119 definitions_with_charset_test ,
120120 definitions_default_queue_type_test ,
121+ definitions_vhost_metadata_test ,
121122 long_definitions_test ,
122123 long_definitions_multipart_test ,
123124 aliveness_test ,
@@ -454,7 +455,6 @@ auth_test(Config) ->
454455 % % NOTE: this one won't have www-authenticate in the response,
455456 % % because user/password are ok, tags are not
456457 test_auth (Config , ? NOT_AUTHORISED , [auth_header (" user" , " user" )]),
457- WrongAuthResponseHeaders = test_auth (Config , ? NOT_AUTHORISED , [auth_header (" guest" , " gust" )]),
458458 % ?assertEqual(true, lists:keymember("www-authenticate", 1, WrongAuthResponseHeaders)),
459459 test_auth (Config , ? OK , [auth_header (" guest" , " guest" )]),
460460 http_delete (Config , " /users/user" , {group , '2xx' }),
@@ -1894,6 +1894,48 @@ defs_default_queue_type_vhost(Config, QueueType) ->
18941894 http_delete (Config , " /vhosts/test-vhost" , {group , '2xx' }),
18951895 ok .
18961896
1897+ definitions_vhost_metadata_test (Config ) ->
1898+ register_parameters_and_policy_validator (Config ),
1899+
1900+ VHostName = <<" test-vhost" >>,
1901+ Desc = <<" Created by definitions_vhost_metadata_test" >>,
1902+ DQT = <<" quorum" >>,
1903+ Tags = [<<" one" >>, <<" tag-two" >>],
1904+ Metadata = #{
1905+ description => Desc ,
1906+ default_queue_type => DQT ,
1907+ tags => Tags
1908+ },
1909+
1910+ % % Create a test vhost
1911+ http_put (Config , " /vhosts/test-vhost" , Metadata , {group , '2xx' }),
1912+ PermArgs = [{configure , <<" .*" >>}, {write , <<" .*" >>}, {read , <<" .*" >>}],
1913+ http_put (Config , " /permissions/test-vhost/guest" , PermArgs , {group , '2xx' }),
1914+
1915+ % % Get the definitions
1916+ Definitions = http_get (Config , " /definitions" , ? OK ),
1917+
1918+ % % Check if vhost definition is correct
1919+ VHosts = maps :get (vhosts , Definitions ),
1920+ {value , VH } = lists :search (fun (VH ) ->
1921+ maps :get (name , VH ) =:= VHostName
1922+ end , VHosts ),
1923+ ct :pal (" VHost: ~p " , [VH ]),
1924+ ? assertEqual (#{
1925+ name => VHostName ,
1926+ description => Desc ,
1927+ default_queue_type => DQT ,
1928+ tags => Tags ,
1929+ metadata => Metadata
1930+ }, VH ),
1931+
1932+ % % Post the definitions back
1933+ http_post (Config , " /definitions" , Definitions , {group , '2xx' }),
1934+
1935+ % % Remove the test vhost
1936+ http_delete (Config , " /vhosts/test-vhost" , {group , '2xx' }),
1937+ ok .
1938+
18971939definitions_default_queue_type_test (Config ) ->
18981940 defs_default_queue_type_vhost (Config , <<" classic" >>),
18991941 defs_default_queue_type_vhost (Config , <<" quorum" >>).
0 commit comments