Created
December 7, 2016 01:52
-
-
Save elbrujohalcon/6bc0fbe0e1010ba2eec84ea9f11a7381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(spts_api_serpents_SUITE). | |
-author('[email protected]'). | |
-include_lib("mixer/include/mixer.hrl"). | |
-mixin([ | |
{spts_test_utils, | |
[ init_per_suite/1 | |
, end_per_suite/1 | |
]} | |
]). | |
-export([all/0]). | |
-export([ post_serpents_wrong/1 | |
, post_serpents_ok/1 | |
, put_serpent_wrong/1 | |
, put_serpent_ok/1 | |
]). | |
-spec all() -> [atom()]. | |
all() -> spts_test_utils:all(?MODULE). | |
-spec post_serpents_wrong(spts_test_utils:config()) -> {comment, []}. | |
post_serpents_wrong(_Config) -> | |
Url = | |
fun(GameId) -> | |
binary_to_list(<<"/games/", GameId/binary, "/serpents">>) | |
end, | |
ct:comment("POST without content-type fails"), | |
#{status_code := 415} = spts_test_utils:api_call(post, Url(<<"x">>)), | |
ct:comment("Something that's not json fails as well"), | |
BadHeaders = #{<<"content-type">> => <<"text/plain">>}, | |
#{status_code := 415} = | |
spts_test_utils:api_call(post, Url(<<"x">>), BadHeaders), | |
… % more tests like the ones above, for wrong and write results | |
% you can find the rest of it here: https://github.com/inaka/serpents/blob/master/test/spts_api_serpents_SUITE.erl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment