=== Test case: graphql_muc_SUITE:admin_send_private_message/1 (click for source code)

=== Config value:

    [{schema_endpoint,admin},
     {listener_opts,[{password,<<"secret">>},
                     {schema_endpoint,<<"admin">>},
                     {username,<<"admin">>}]},
     {watchdog,<0.18740.0>},
     {mam_backend,rdbms},
     {mim_data_dir,"/home/circleci/project/big_tests/tests/graphql_muc_SUITE_data"},
     {preset,"pgsql_mnesia"},
     {tc_logfile,"/home/circleci/project/big_tests/ct_report/ct_run.test@df370d24fb6d.2022-05-11_08.56.40/big_tests.tests.graphql_muc_SUITE.logs/run.2022-05-11_08.59.30/graphql_muc_suite.admin_send_private_message.23811.html"},
     {tc_group_properties,[{name,admin_muc},parallel]},
     {tc_group_path,[]},
     {data_dir,"/home/circleci/project/big_tests/_build/default/lib/mongoose_tests/ebin/graphql_muc_SUITE_data/"},
     {priv_dir,"/home/circleci/project/big_tests/ct_report/ct_run.test@df370d24fb6d.2022-05-11_08.56.40/big_tests.tests.graphql_muc_SUITE.logs/run.2022-05-11_08.59.30/log_private/"},
     {{saved_modules,mongooseim@localhost,<<"test type">>},
      #{mod_adhoc => #{iqdisc => one_queue,report_commands_node => false},
        mod_amp => #{},
        mod_bosh =>
            #{backend => mnesia,inactivity => 30,max_pause => 120,
              max_wait => infinity,server_acks => false},
        mod_cache_users =>
            #{number_of_segments => 5,strategy => fifo,time_to_live => 2},
        mod_carboncopy => #{iqdisc => no_queue},
        mod_commands => #{},
        mod_disco =>
            #{extra_domains => [],iqdisc => one_queue,server_info => [],
              users_can_see_hidden_services => false},
        mod_muc_commands => #{},mod_muc_light_commands => #{},
        mod_register =>
            #{access => register,
              ip_access => [{allow,"127.0.0.0/8"},{deny,"0.0.0.0/0"}],
              iqdisc => one_queue,password_strength => 0,
              registration_watchers => []},
        mod_roster =>
            #{backend => rdbms,iqdisc => one_queue,store_current_id => false,
              versioning => false},
        mod_sic => #{iqdisc => one_queue},
        mod_stream_management =>
            #{ack => true,ack_freq => 1,backend => mnesia,buffer => true,
              buffer_max => 100,resume_timeout => 600,
              stale_h =>
                  #{enabled => false,geriatric => 3600,repeat_after => 1800}},
        mod_vcard =>
            #{backend => rdbms,
              host => {prefix,<<"vjud.">>},
              iqdisc => parallel,matches => 30,search => true}}}]

=== Current directory is "/home/circleci/project/big_tests/ct_report/ct_run.test@df370d24fb6d.2022-05-11_08.56.40"

=== Started at 2022-05-11 08:59:30


*** CT 2022-05-11 08:59:30.982 *** View log from node mongooseim@localhost when started mongooseim@localhost_803.html
*** CT 2022-05-11 08:59:30.983 *** View log from node ejabberd2@localhost when started ejabberd2@localhost_431.html

*** User 2022-05-11 08:59:31.024 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
<stream:stream to='domain.example.com' version='1.0' xml:lang='en' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>

*** User 2022-05-11 08:59:31.025 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='a2834c011fcc486d' from='domain.example.com' version='1.0' xml:lang='en'>

*** User 2022-05-11 08:59:31.026 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<stream:features>
	<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
	<compression xmlns='http://jabber.org/features/compress'>
		<method>zlib</method>
	</compression>
	<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
		<mechanism>SCRAM-SHA-256</mechanism>
		<mechanism>PLAIN</mechanism>
	</mechanisms>
	<register xmlns='http://jabber.org/features/iq-register'/>
	<amp xmlns='http://jabber.org/feature/amp'/>
	<sm xmlns='urn:xmpp:sm:3'/>
</stream:features>



*** User 2022-05-11 08:59:31.026 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>AGFsaWNFX2FkbWluX3NlbmRfcHJpdmF0ZV9tZXNzYWdlXzc3OABtYXR5Z3J5c2E=</auth>



*** User 2022-05-11 08:59:31.028 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>



*** User 2022-05-11 08:59:31.028 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
<stream:stream to='domain.example.com' version='1.0' xml:lang='en' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>

*** User 2022-05-11 08:59:31.029 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='d3640e0c7920ec9c' from='domain.example.com' version='1.0' xml:lang='en'>

*** User 2022-05-11 08:59:31.029 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<stream:features>
	<compression xmlns='http://jabber.org/features/compress'>
		<method>zlib</method>
	</compression>
	<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
	<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
	<register xmlns='http://jabber.org/features/iq-register'/>
	<amp xmlns='http://jabber.org/feature/amp'/>
	<sm xmlns='urn:xmpp:sm:3'/>
</stream:features>



*** User 2022-05-11 08:59:31.029 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
<iq type='set' id='38ff445dc279a2e343fef2764402a4ec'>
	<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
		<resource>res1</resource>
	</bind>
</iq>



*** User 2022-05-11 08:59:31.030 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<iq id='38ff445dc279a2e343fef2764402a4ec' type='result'>
	<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
		<jid>alicE_admin_send_private_message_778@domain.example.com/res1</jid>
	</bind>
</iq>



*** User 2022-05-11 08:59:31.030 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
<iq type='set' id='ef913db55d69f940857dd4a8c9fd1dcb'>
	<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>



*** User 2022-05-11 08:59:31.031 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<iq type='result' id='ef913db55d69f940857dd4a8c9fd1dcb'>
	<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>



*** User 2022-05-11 08:59:31.031 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
<presence/>



*** User 2022-05-11 08:59:31.076 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<presence from='alicE_admin_send_private_message_778@domain.example.com/res1' to='alice_admin_send_private_message_778@domain.example.com/res1' xml:lang='en'/>



*** User 2022-05-11 08:59:31.078 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
<stream:stream to='domain.example.com' version='1.0' xml:lang='en' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>

*** User 2022-05-11 08:59:31.079 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='166f67b8f4ad28e4' from='domain.example.com' version='1.0' xml:lang='en'>

*** User 2022-05-11 08:59:31.079 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<stream:features>
	<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
	<compression xmlns='http://jabber.org/features/compress'>
		<method>zlib</method>
	</compression>
	<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
		<mechanism>SCRAM-SHA-256</mechanism>
		<mechanism>PLAIN</mechanism>
	</mechanisms>
	<register xmlns='http://jabber.org/features/iq-register'/>
	<amp xmlns='http://jabber.org/feature/amp'/>
	<sm xmlns='urn:xmpp:sm:3'/>
</stream:features>



*** User 2022-05-11 08:59:31.079 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>AGJPYl9hZG1pbl9zZW5kX3ByaXZhdGVfbWVzc2FnZV83NzgAbWFrcm9saWth</auth>



*** User 2022-05-11 08:59:31.082 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>



*** User 2022-05-11 08:59:31.083 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
<stream:stream to='domain.example.com' version='1.0' xml:lang='en' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>

*** User 2022-05-11 08:59:31.084 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='79e7f0d75be1fb29' from='domain.example.com' version='1.0' xml:lang='en'>

*** User 2022-05-11 08:59:31.084 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<stream:features>
	<compression xmlns='http://jabber.org/features/compress'>
		<method>zlib</method>
	</compression>
	<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
	<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
	<register xmlns='http://jabber.org/features/iq-register'/>
	<amp xmlns='http://jabber.org/feature/amp'/>
	<sm xmlns='urn:xmpp:sm:3'/>
</stream:features>



*** User 2022-05-11 08:59:31.084 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
<iq type='set' id='5e3149c985dd78d8fc5d3a6c51359df9'>
	<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
		<resource>res1</resource>
	</bind>
</iq>



*** User 2022-05-11 08:59:31.085 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<iq id='5e3149c985dd78d8fc5d3a6c51359df9' type='result'>
	<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
		<jid>bOb_admin_send_private_message_778@domain.example.com/res1</jid>
	</bind>
</iq>



*** User 2022-05-11 08:59:31.086 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
<iq type='set' id='e402d04043db621f11d56940df96e176'>
	<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>



*** User 2022-05-11 08:59:31.087 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<iq type='result' id='e402d04043db621f11d56940df96e176'>
	<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>



*** User 2022-05-11 08:59:31.087 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
<presence/>



*** User 2022-05-11 08:59:31.097 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<presence from='bOb_admin_send_private_message_778@domain.example.com/res1' to='bob_admin_send_private_message_778@domain.example.com/res1' xml:lang='en'/>



*** User 2022-05-11 08:59:31.097 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
<presence to='room-alice_admin_send_private_message_778@groupchats.domain.example.com/Ali'/>



*** User 2022-05-11 08:59:31.102 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
<presence from='room-alice_admin_send_private_message_778@groupchats.domain.example.com/Ali' to='alicE_admin_send_private_message_778@domain.example.com/res1' xml:lang='en'>
	<x xmlns='http://jabber.org/protocol/muc#user'>
		<item jid='alicE_admin_send_private_message_778@domain.example.com/res1' affiliation='owner' role='moderator'/>
		<status code='110'/>
		<status code='201'/>
	</x>
</presence>



*** User 2022-05-11 08:59:31.102 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
<presence to='room-alice_admin_send_private_message_778@groupchats.domain.example.com/Bobek'/>



*** User 2022-05-11 08:59:31.105 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<presence from='room-alice_admin_send_private_message_778@groupchats.domain.example.com/Ali' to='bOb_admin_send_private_message_778@domain.example.com/res1' xml:lang='en'>
	<x xmlns='http://jabber.org/protocol/muc#user'>
		<item affiliation='owner' role='moderator'/>
	</x>
</presence>



*** User 2022-05-11 08:59:31.106 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<presence from='room-alice_admin_send_private_message_778@groupchats.domain.example.com/Bobek' to='bOb_admin_send_private_message_778@domain.example.com/res1' xml:lang='en'>
	<x xmlns='http://jabber.org/protocol/muc#user'>
		<item affiliation='none' role='participant'/>
		<status code='110'/>
	</x>
</presence>



*** User 2022-05-11 08:59:31.106 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<message from='room-alice_admin_send_private_message_778@groupchats.domain.example.com' to='bOb_admin_send_private_message_778@domain.example.com/res1' type='groupchat'>
	<subject/>
	<body/>
</message>



*** User 2022-05-11 08:59:31.108 ***
REST request fails:
Code: 400
Req: {<0.19331.0>,<<"/api/graphql">>,<<"POST">>,
      [{<<"Content-Type">>,<<"application/json">>},
       {<<"Request-Id">>,<<"321fd008cd18e384">>},
       {<<"authorization">>,<<"Basic YWRtaW46c2VjcmV0">>}],
      <<"{\"variables\":{\"toNick\":\"Bobek\",\"room\":\"room-alice_admin_send_private_message_778@groupchats.domain.example.com\",\"from\":\"alicE_admin_send_private_message_778@domain.example.com\",\"body\":\"Hello Bob!\"},\"query\":\"mutation M1($room: JID!, $from: FullJID!, $toNick: String!, $body: String!)\\n              { muc { sendPrivateMessage(room: $room, from: $from, toNick: $toNick, body: $body) } }\",\"operationName\":\"M1\"}">>}
Result: {{<<"400">>,<<"Bad Request">>},
         [{<<"vary">>,<<"accept">>},
          {<<"server">>,<<"Cowboy">>},
          {<<"date">>,<<"Wed, 11 May 2022 08:59:30 GMT">>},
          {<<"content-type">>,<<"application/json">>},
          {<<"content-length">>,<<"247">>}],
         <<"{\"errors\":[{\"path\":[\"M1\",\"from\"],\"message\":\"Input coercion failed for type FullJID with value <<\\\"alicE_admin_send_private_message_778@domain.example.com\\\">>. The reason it failed is: jid_without_resource\",\"extensions\":{\"code\":\"input_coercion\"}}]}">>,
         395,999}
Params: #{body =>
              <<"{\"variables\":{\"toNick\":\"Bobek\",\"room\":\"room-alice_admin_send_private_message_778@groupchats.domain.example.com\",\"from\":\"alicE_admin_send_private_message_778@domain.example.com\",\"body\":\"Hello Bob!\"},\"query\":\"mutation M1($room: JID!, $from: FullJID!, $toNick: String!, $body: String!)\\n              { muc { sendPrivateMessage(room: $room, from: $from, toNick: $toNick, body: $body) } }\",\"operationName\":\"M1\"}">>,
          creds => {<<"admin">>,<<"secret">>},
          method => <<"POST">>,path => <<"/api/graphql">>,port => 5551,
          return_headers => true,return_maps => true,
          role => {graphql,<<"admin">>},
          server => #{node => mongooseim@localhost}}


*** User 2022-05-11 08:59:31.112 ***
REST request:
Code: 200
Req: {<0.19343.0>,<<"/api/graphql">>,<<"POST">>,
      [{<<"Content-Type">>,<<"application/json">>},
       {<<"Request-Id">>,<<"2b024bd655e3e6c1">>},
       {<<"authorization">>,<<"Basic YWRtaW46c2VjcmV0">>}],
      <<"{\"variables\":{\"toNick\":\"Bobek\",\"room\":\"room-alice_admin_send_private_message_778@groupchats.domain.example.com\",\"from\":\"alicE_admin_send_private_message_778@domain.example.com/res1\",\"body\":\"Hello Bob!\"},\"query\":\"mutation M1($room: JID!, $from: FullJID!, $toNick: String!, $body: String!)\\n              { muc { sendPrivateMessage(room: $room, from: $from, toNick: $toNick, body: $body) } }\",\"operationName\":\"M1\"}">>}
Result: {{<<"200">>,<<"OK">>},
         [{<<"vary">>,<<"accept">>},
          {<<"server">>,<<"Cowboy">>},
          {<<"date">>,<<"Wed, 11 May 2022 08:59:30 GMT">>},
          {<<"content-type">>,<<"application/json">>},
          {<<"content-length">>,<<"67">>}],
         <<"{\"data\":{\"muc\":{\"sendPrivateMessage\":\"Message sent successfully\"}}}">>,
         205,1992}
Params: #{body =>
              <<"{\"variables\":{\"toNick\":\"Bobek\",\"room\":\"room-alice_admin_send_private_message_778@groupchats.domain.example.com\",\"from\":\"alicE_admin_send_private_message_778@domain.example.com/res1\",\"body\":\"Hello Bob!\"},\"query\":\"mutation M1($room: JID!, $from: FullJID!, $toNick: String!, $body: String!)\\n              { muc { sendPrivateMessage(room: $room, from: $from, toNick: $toNick, body: $body) } }\",\"operationName\":\"M1\"}">>,
          creds => {<<"admin">>,<<"secret">>},
          method => <<"POST">>,path => <<"/api/graphql">>,port => 5551,
          return_headers => true,return_maps => true,
          role => {graphql,<<"admin">>},
          server => #{node => mongooseim@localhost}}


*** User 2022-05-11 08:59:31.177 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
<message from='room-alice_admin_send_private_message_778@groupchats.domain.example.com/Ali' to='bOb_admin_send_private_message_778@domain.example.com/res1' type='chat'>
	<body>Hello Bob!</body>
	<x xmlns='http://jabber.org/protocol/muc'/>
	<stanza-id by='bOb_admin_send_private_message_778@domain.example.com' id='BNLOL381M8G1' xmlns='urn:xmpp:sid:0'/>
</message>



*** User 2022-05-11 08:59:31.177 ***
bOb_admin_send_private_message_778@domain.example.com/res1 out
</stream:stream>

*** User 2022-05-11 08:59:31.177 ***
bOb_admin_send_private_message_778@domain.example.com/res1 in
</stream:stream>

*** User 2022-05-11 08:59:31.178 ***
alicE_admin_send_private_message_778@domain.example.com/res1 out
</stream:stream>

*** User 2022-05-11 08:59:31.178 ***
alicE_admin_send_private_message_778@domain.example.com/res1 in
</stream:stream>
*** CT 2022-05-11 08:59:31.207 *** View log from node ejabberd2@localhost when finished ejabberd2@localhost_431.html
*** CT 2022-05-11 08:59:31.207 *** View log from node mongooseim@localhost when finished mongooseim@localhost_803.html



=== Ended at 2022-05-11 08:59:31
=== successfully completed test case
=== === Returned value: ok