From ba73b04de93583d88f316a1c89e93ee1f8961467 Mon Sep 17 00:00:00 2001 From: Thomas Arts Date: Mon, 4 May 2020 15:22:53 +0200 Subject: [PATCH 1/2] Fix CSV chat room GH#384 --- test/server_SUITE.erl | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/test/server_SUITE.erl b/test/server_SUITE.erl index a0a9c72e9..55d0596b3 100644 --- a/test/server_SUITE.erl +++ b/test/server_SUITE.erl @@ -374,11 +374,12 @@ chat_csv(Cfg) -> User = nynja:connect_user(Phone), UserClientId = nynja:user_client(User), - Token = nynja:jwt_token(nynja:user_roster_uuid(User)), + UserToken = nynja:jwt_token(nynja:user_roster_uuid(User)), Friend = nynja:connect_user(FriendPhone), - %% FriendId = nynja:user_roster_uuid(Friend), FriendId = nynja:user_client(Friend), + FriendToken = nynja:jwt_token(nynja:user_roster_uuid(Friend)), + FeedId = nynja:become_friends(User, Friend), ct:log("Friends: ~p and ~p -> ~p\n", [Phone, FriendPhone, FeedId]), @@ -389,23 +390,23 @@ chat_csv(Cfg) -> ct:log("Messages sent"), - %% Investigate why this does not work - %% {ok, 200, _} = - _ = + {ok, 200, _} = + request('ChatsCSV', + #{phone_id => nynja:user_roster(User), from => 1000000, text => true}, [token_auth(FriendToken, FriendId) | Cfg]), + + {ok, 200, CSV} = request('ChatsCSV', - #{phone_id => FriendId, from => 1000000, text => true}, [token_auth(Token, UserClientId) | Cfg]), + #{phone_id => nynja:user_roster(Friend), from => 1000000, text => true}, [token_auth(UserToken, UserClientId) | Cfg]), - %% {ok, 404, #{message := <<"No chat history for specified period">>}} = - %% request('ChatsCSV', - %% #{phone_id => FriendId, audio => true}, [token_auth(Token, UserClientId) | Cfg]), + ct:log("CSV in lines ~p", [string:split(CSV, "\n", all)]), - %% {ok, 401, <<"Token is invalid">>} = - %% request('ChatsCSV', - %% #{room_id => FriendId, text => true}, [token_auth(Token, FriendId) | Cfg]), + {ok, 404, #{message := <<"No chat history for specified period">>}} = + request('ChatsCSV', + #{phone_id => nynja:user_roster(Friend), audio => true}, [token_auth(UserToken, UserClientId) | Cfg]), - %% {ok, 404, #{message := _Binary}} = - %% request('ChatsCSV', - %% #{room_id => nynja:user_roster_uuid(Friend), text => true}, [token_auth(Token, UserClientId) | Cfg]), + {ok, 401, <<"Token is invalid">>} = + request('ChatsCSV', + #{phone_id => nynja:user_roster(User), text => true}, [token_auth(UserToken, FriendId) | Cfg]), ok. -- GitLab From 8c0770077943b9c4f02f4903d2aeab0f5e6d0556 Mon Sep 17 00:00:00 2001 From: Thomas Arts Date: Mon, 4 May 2020 16:14:57 +0200 Subject: [PATCH 2/2] Update nynja.yaml specification --- spec/nynja_rest.yaml | 2 +- test/api_nynja.erl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/nynja_rest.yaml b/spec/nynja_rest.yaml index 61661cd53..93b439302 100644 --- a/spec/nynja_rest.yaml +++ b/spec/nynja_rest.yaml @@ -378,7 +378,7 @@ paths: type: object properties: server_message_id: - type: string + type: integer '400': description: "Malformed request" content: diff --git a/test/api_nynja.erl b/test/api_nynja.erl index b68545c8c..17e06db8c 100644 --- a/test/api_nynja.erl +++ b/test/api_nynja.erl @@ -1,6 +1,6 @@ %% coding: latin-1 %% This code is generated from ../server/spec/nynja_rest.yaml -%% on 2020-04-27 13:59:49 UTC +%% on 2020-05-04 14:12:48 UTC %% Using openapi rebar3 plugin version: #6ad56be %% Do not manually change this code! %% @@ -466,8 +466,8 @@ operations() -> #{<<"data">> => #{<<"properties">> => #{<<"server_message_id">> => - #{<<"type">> => <<"integer">>} - }, + #{<<"type">> => + <<"integer">>}}, <<"type">> => <<"object">>}, <<"status">> => #{<<"type">> => <<"string">>}}, -- GitLab