Skip to content

Commit

Permalink
Refactor invalid host testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekwegr committed Dec 6, 2023
1 parent 04a0f5d commit e0d1fd1
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions test/config_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1867,8 +1867,9 @@ mod_http_upload(_Config) ->
?errh(T(RequiredOpts#{<<"host">> => <<"is this a host? no.">>})),
?errh(T(RequiredOpts#{<<"host">> => <<"invalid-.com">>})),
?errh(T(RequiredOpts#{<<"host">> => <<"-invalid.com">>})),
?errh(T(RequiredOpts#{<<"host">> => [<<"invalid.sub@HOST@">>]})),
?errh(T(RequiredOpts#{<<"host">> => [<<"invalid.sub.@HOST@.as.well">>]})),
?errh(T(RequiredOpts#{<<"host">> => [<<"valid.@HOST@">>]})),
?errh(T(RequiredOpts#{<<"host">> => <<"invalid.sub@HOST@">>})),
?errh(T(RequiredOpts#{<<"host">> => <<"invalid.sub.@HOST@.as.well">>})),
?errh(T(RequiredOpts#{<<"host">> => [<<"not.supported.any.more.@HOSTS@">>]})),
check_iqdisc(mod_http_upload, RequiredOpts).

Expand Down Expand Up @@ -1993,8 +1994,9 @@ mod_mam_muc(_Config) ->
?cfgh(P ++ [host], {prefix, <<"muc.">>}, T(#{<<"host">> => <<"muc.@HOST@">>})),
?cfgh(P ++ [host], {fqdn, <<"muc.test">>}, T(#{<<"host">> => <<"muc.test">>})),
?errh(T(#{<<"host">> => <<"is this a host? no.">>})),
?errh(T(#{<<"host">> => [<<"invalid.sub@HOST@">>]})),
?errh(T(#{<<"host">> => [<<"invalid.sub.@HOST@.as.well">>]})),
?errh(T(#{<<"host">> => [<<"valid.@HOST@">>]})),
?errh(T(#{<<"host">> => <<"invalid.sub@HOST@">>})),
?errh(T(#{<<"host">> => <<"invalid.sub.@HOST@.as.well">>})),
?errh(T(#{<<"archive_groupchats">> => true})), % pm-only
?errh(T(#{<<"same_mam_id_for_peers">> => true})). % pm-only

Expand Down Expand Up @@ -2115,8 +2117,9 @@ mod_muc(_Config) ->
T(<<"hibernated_room_timeout">>, 0)),
?errh(T(<<"host">>, <<>>)),
?errh(T(<<"host">>, <<"is this a host? no.">>)),
?errh(T(<<"host">>, [<<"invalid.sub@HOST@">>])),
?errh(T(<<"host">>, [<<"invalid.sub.@HOST@.as.well">>])),
?errh(T(<<"host">>, [<<"valid.@HOST@">>])),
?errh(T(<<"host">>, <<"invalid.sub@HOST@">>)),
?errh(T(<<"host">>, <<"invalid.sub.@HOST@.as.well">>)),
?errh(T(<<"backend">>, <<"amnesia">>)),
?errh(T(<<"access">>, <<>>)),
?errh(T(<<"access_create">>, 1)),
Expand Down Expand Up @@ -2287,9 +2290,10 @@ mod_muc_light(_Config) ->
?errh(T(#{<<"backend">> => <<"frontend">>})),
?errh(T(#{<<"host">> => <<"what is a domain?!">>})),
?errh(T(#{<<"host">> => <<"invalid..com">>})),
?errh(T(#{<<"host">> => [<<"invalid.sub@HOST@">>]})),
?errh(T(#{<<"host">> => [<<"invalid.sub.@HOST@.as.well">>]})),
?errh(T(#{<<"host">> => [<<"inv@lidsub.@HOST@">>]})),
?errh(T(#{<<"host">> => [<<"valid.@HOST@">>]})),
?errh(T(#{<<"host">> => <<"invalid.sub@HOST@">>})),
?errh(T(#{<<"host">> => <<"invalid.sub.@HOST@.as.well">>})),
?errh(T(#{<<"host">> => <<"inv@lidsub.@HOST@">>})),
?errh(T(#{<<"equal_occupants">> => <<"true">>})),
?errh(T(#{<<"legacy_mode">> => 1234})),
?errh(T(#{<<"rooms_per_user">> => 0})),
Expand Down Expand Up @@ -2427,8 +2431,9 @@ mod_pubsub(_Config) ->
?errh(T(#{<<"host">> => <<"is this a host? no.">>})),
?errh(T(#{<<"host">> => <<"invalid domain.com">>})),
?errh(T(#{<<"host">> => <<"inv@lid.com">>})),
?errh(T(#{<<"host">> => [<<"invalid.sub@HOST@">>]})),
?errh(T(#{<<"host">> => [<<"invalid.sub.@HOST@.as.well">>]})),
?errh(T(#{<<"host">> => [<<"valid.@HOST@">>]})),
?errh(T(#{<<"host">> => <<"invalid.sub@HOST@">>})),
?errh(T(#{<<"host">> => <<"invalid.sub.@HOST@.as.well">>})),
?errh(T(#{<<"backend">> => <<"amnesia">>})),
?errh(T(#{<<"access_createnode">> => <<"">>})),
?errh(T(#{<<"max_items_node">> => -1})),
Expand Down Expand Up @@ -2761,8 +2766,9 @@ mod_vcard(_Config) ->
?errh(T(#{<<"host">> => 1})),
?errh(T(#{<<"host">> => <<" ">>})),
?errh(T(#{<<"host">> => <<"is this a host? no.">>})),
?errh(T(#{<<"host">> => [<<"invalid.sub@HOST@">>]})),
?errh(T(#{<<"host">> => [<<"invalid.sub.@HOST@.as.well">>]})),
?errh(T(#{<<"host">> => [<<"valid.@HOST@">>]})),
?errh(T(#{<<"host">> => <<"invalid.sub@HOST@">>})),
?errh(T(#{<<"host">> => <<"invalid.sub.@HOST@.as.well">>})),
?errh(T(#{<<"search">> => 1})),
?errh(T(#{<<"backend">> => <<"mememesia">>})),
?errh(T(#{<<"matches">> => -1})),
Expand Down

0 comments on commit e0d1fd1

Please sign in to comment.