File manager - Edit - /home/u478019808/domains/bestandroidphones.store/public_html/static/img/logo/system_tests.zip
Back
PK #1�ZW/�O� � , system_tests_sync/test_oauth2_credentials.pynu �[��� # Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import json from google.auth import _helpers import google.oauth2.credentials GOOGLE_OAUTH2_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token" def test_refresh(authorized_user_file, http_request, token_info): with open(authorized_user_file, "r") as fh: info = json.load(fh) credentials = google.oauth2.credentials.Credentials( None, # No access token, must be refreshed. refresh_token=info["refresh_token"], token_uri=GOOGLE_OAUTH2_TOKEN_ENDPOINT, client_id=info["client_id"], client_secret=info["client_secret"], ) credentials.refresh(http_request) assert credentials.token info = token_info(credentials.token) info_scopes = _helpers.string_to_scopes(info["scope"]) # Canonical list of scopes at https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login # or do `gcloud auth application-defaut login --help` canonical_scopes = set( [ "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/cloud-platform", "openid", ] ) # When running the test locally, we always have an additional "accounts.reauth" scope. canonical_scopes_with_reauth = canonical_scopes.copy() canonical_scopes_with_reauth.add("https://www.googleapis.com/auth/accounts.reauth") assert set(info_scopes) == canonical_scopes or set(info_scopes) == canonical_scopes_with_reauth PK #1�ZQ�j�H H # system_tests_sync/test_mtls_http.pynu �[��� # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import json import mock import os import time from os import path import google.auth import google.auth.credentials from google.auth import environment_vars from google.auth.transport import mtls import google.auth.transport.requests import google.auth.transport.urllib3 MTLS_ENDPOINT = "https://pubsub.mtls.googleapis.com/v1/projects/{}/topics" REGULAR_ENDPOINT = "https://pubsub.googleapis.com/v1/projects/{}/topics" def test_requests(): credentials, project_id = google.auth.default() credentials = google.auth.credentials.with_scopes_if_required( credentials, ["https://www.googleapis.com/auth/pubsub"] ) authed_session = google.auth.transport.requests.AuthorizedSession(credentials) with mock.patch.dict(os.environ, {environment_vars.GOOGLE_API_USE_CLIENT_CERTIFICATE: "true"}): authed_session.configure_mtls_channel() # If the devices has default client cert source, then a mutual TLS channel # is supposed to be created. assert authed_session.is_mtls == mtls.has_default_client_cert_source() # Sleep 1 second to avoid 503 error. time.sleep(1) if authed_session.is_mtls: response = authed_session.get(MTLS_ENDPOINT.format(project_id)) else: response = authed_session.get(REGULAR_ENDPOINT.format(project_id)) assert response.ok def test_urllib3(): credentials, project_id = google.auth.default() credentials = google.auth.credentials.with_scopes_if_required( credentials, ["https://www.googleapis.com/auth/pubsub"] ) authed_http = google.auth.transport.urllib3.AuthorizedHttp(credentials) with mock.patch.dict(os.environ, {environment_vars.GOOGLE_API_USE_CLIENT_CERTIFICATE: "true"}): is_mtls = authed_http.configure_mtls_channel() # If the devices has default client cert source, then a mutual TLS channel # is supposed to be created. assert is_mtls == mtls.has_default_client_cert_source() # Sleep 1 second to avoid 503 error. time.sleep(1) if is_mtls: response = authed_http.request("GET", MTLS_ENDPOINT.format(project_id)) else: response = authed_http.request("GET", REGULAR_ENDPOINT.format(project_id)) assert response.status == 200 def test_requests_with_default_client_cert_source(): credentials, project_id = google.auth.default() credentials = google.auth.credentials.with_scopes_if_required( credentials, ["https://www.googleapis.com/auth/pubsub"] ) authed_session = google.auth.transport.requests.AuthorizedSession(credentials) if mtls.has_default_client_cert_source(): with mock.patch.dict(os.environ, {environment_vars.GOOGLE_API_USE_CLIENT_CERTIFICATE: "true"}): authed_session.configure_mtls_channel( client_cert_callback=mtls.default_client_cert_source() ) assert authed_session.is_mtls # Sleep 1 second to avoid 503 error. time.sleep(1) response = authed_session.get(MTLS_ENDPOINT.format(project_id)) assert response.ok def test_urllib3_with_default_client_cert_source(): credentials, project_id = google.auth.default() credentials = google.auth.credentials.with_scopes_if_required( credentials, ["https://www.googleapis.com/auth/pubsub"] ) authed_http = google.auth.transport.urllib3.AuthorizedHttp(credentials) if mtls.has_default_client_cert_source(): with mock.patch.dict(os.environ, {environment_vars.GOOGLE_API_USE_CLIENT_CERTIFICATE: "true"}): assert authed_http.configure_mtls_channel( client_cert_callback=mtls.default_client_cert_source() ) # Sleep 1 second to avoid 503 error. time.sleep(1) response = authed_http.request("GET", MTLS_ENDPOINT.format(project_id)) assert response.status == 200 PK #1�Z�~G�S( S( ! system_tests_sync/secrets.tar.encnu �[��� $ �MU Udg���`*���+%�Xf�'�� >�4I�P �eU-��uS$�MW=_P�\X?�f�X����ȳ������_u������5�C�����>p#q��8P����wG�|�5X9�T.6(,?���0� K��ewM@�,WpmFy<���H���,b��RW#�� ��MN��\��Ej���#&����RUzi��%����a�h�C8��>?b?Ԏ����]�n�W;���H1� ��/����t뎩�W������2��Bž�K2��� a���gbW2/���Α ��-�(1� ��@�+(��T��I�'E��Uו���f��w� �����9,��{%�!�jCM�F�w�j�ȃ���a��N-�Q`aҔ��Y:��s� E ��c4�^�{�*G�f$�z<.sb;j�gh�z YI�ϰ��w�P{:���|�����5�g��az�����W��"�)�e%�g�� )��?�4Q:�at��{��e,aS�+`���]�����s�g�Aܲ���>�A�rT�����c�L��u�\=kE��v����sf�V3��k8؇ҸL} ���� ػ8G(*Qjl�4��p��B�զ�=X���J�������# ;ޤ�c9������E�~�ftГnhu��Uw bv`/�q�h��.�h>�P�Qn��PэԐ����\`)|b���<$����y�8腼 g����<�<n_��i� T�q��s��rf?�y�@��$j��@ǩ�#פ !���ݵ�e �?�V_�� �������[٤(W��m��Ŀ��_9(�ma�rVHG<��ΞP�l�z��1h���| e+i_F�m|c�A=o8x�@6��z�[O�xO��v�*�Դ��;w9�tőa�n�YX�0z�pL�t ��P��j�R��D�� ^.���OsC��;�&�E�]n�/!~C��J�Lʪ�T� ����|��y��q `A�,��� ٮ�`�Z��T��������GqO����=�ء�3hj��AM�@p�Y����y,g0�C�?��p�6��.���������k�a6����ł>pn�����k��@��w�o.'�:9�i+y^T�� Q��ޢ�R'%H��ܠ��?����K�,�P����7|�i�d"V5L��B`�8Q��Q�o8��O�(���zxI��BR$��|9Q��a'���ߢ� �'Eh[�B��*^f VL�U��B�Vܤ��FU+��b�������/c�)')ë�8�Y�����2H����C��f�!$�U�5��DM�(]B=T(+f�u�s��&���7A�XX�wW��Ѹ�� �Q[�ΰ�+@#b���yw֟#��g��{���#?�9�v�P�oA�ճ-���*9EQo���k��1���hq�`�wmJn���u�s��-�~H,��_�Ox38c�6�j����L�d^yx[i3��W�L�~�n�D�vY�N)w��J�D�b(#�ص��r��P�?���R�OHF�U>��SʐJ)�I�#��#��v'�}�C�I�nY��da��$I<�����P�����b��Y��W��q(��7�O乂��ڃ�)��\Q��3S��S��V�`6�e�9���@*q��nT��T�������8��[Y�9T�A�v��Y��WԨi'��.�m(�����k9?g���u#��z��ݭp%!S_{�ƺ�Yo�c�sA# &�|ƥ��$`y!�ާ� 86�^��Zj��L��?����Sm�<�g[���|ƜH��s4 At�0#�J��VC6�5�|���0�쇟�s%���s���d:�f&c+r�r�pBg]Q����p�:��&[E��.�JN���N����ކ^y��̊A�r� (���R�B�&��dXi��}��w��ǵ�D������n��,��]����B��~�q�7ݗ Eր�Eo�:z�Ģ͂��Vԧ����mU����q��.�pڏV�yP�FB�S�]�v��� �(�;����+;��;��g%6F�6[֗��I����#. �� ���{�p`��,i��r�k��.Ԍ�߿z#-q%��'�o-�V�l�6����}2���ט������&��s^a�|��&٩� ��Lo�oW���>�Y�=�RqG��0�@N�v� w��C8����U;o�g;W���K� �lPYo�C��9�c9�\d� O���`�En�m9 �n�%���eG��m���k��:���4��%���x��HB *��}x�����Iv �:�Z�-�M/� ��E��h��b ��d��lDQ�dIg�K!&S�3���ܼ�nZ#I�̻��T�q1���׀~�z�T�X&�, �~�C{�5ٯ !/7�ފn���mn�s����a�fj�Ώ��Q��=7[����SI��kУ�����^~S y�A�؉Y^�hhECN�c��`�f.��� [\�ѸY�C��t�6m\52�kJHd`v�?��.Ed���=0��S�~�` /�1��PL�H��[�{:�C@�����HReߧ�}H3���� ��x�H\���Mbx�i��ֲ�]?{��A��8�/s�P�R!aß{�F��WV�q�D\e����.)�l�#��ك�8�I3s~ �|�i6@B��DtA��&��|�.Ipf��a�u��$�u� �m���E�v4J& �g8HD���y'�ݮ��鹕��7�u�a��Tw@p��y(�0 ���L����C��Y �9�VE�$�_�z_"�'P��d��m��K��������o�O�\��'lmdJ�r�T�nB�I���%�;#��] �g ��} �Z&g�4��~̈U���v����zq��1�Gi����jVuٙ�{�^�f�t�]�P�Lp2l� Pm8���=�[�7�ї^��ǻ�c݆� �4ݩ�Q@��}z����!s��^H�tB��W�U���-�����}R? Ք��p<9ߕJ� .�R����LD ��9]��e���"�+)2 �vE�)A�&�ZsMc(��Hʙ�Ქ`�z�/_��l�z� �\�/� p�G�{�>)$V)xV]��p�g.jTN-�'�$�Bf�gN=p�פJ�b����P��%:������g��𝨍t� �E>�rؿ��T�3mpJi�a-���V�ݎMk:�&���������趽,�t&e�Anfc�����;�HL�u���+r ז7�Q��z�օ-��E�����sn�έ��InLގ?�_��<7'n��9ś%�n�cgl���zFQ;c�`f5-��G���9�3�v��g+��?��m�T"��4��)Z�brd��� ��2C~��༹Q ���V��~|S��7&�E۹Q�zm��:�T��YV1�6"���p�>44E���R+�h�?�@�� �%1?��5�mp/�6���_�p D���,x�U�ˎ#�a���%�Ͽ\u�6JI�����F��n��Oh9�ؖc�i��I.�M>��u)Y\��e-�ώ��|~]ٗ�}�ɇ����P������/�GCQԸ���ي$��O�f9NŃ�#$Ҧ�;�3�Җahs�{�� �k�a��y�%ʯ�r��ł��3g�E�G4^0�Dqc�>���8e0�]��Sf�|�i���M�v�c>��/f�M�5��y�l��Y��~����G!udO�(�U�� � g��-��K3���@��aLVh�~�5�wI{d��r���[�o�^E���w���| =�vWQ)6��糗����^l%�)�d�|yZ ����"�/� �-�f�6��m��a"�eyFU�ܐ�_��Uot9���_9!X��B\#�����U�U �ٹ�'�#3ec1+ҵh�;���yu�0^����`X�2��-�eA��U��ݐ�qv���-�k���<��[Q��L!�#�f�1�F��k%���m���V.64X��Z�a��A羐��β���nj�63��ݛ�V:o_k���=�F_`�Û�bԴ�F�rYb��;���gL�*8r����hX�U=?\/<sP���>/HC��@���(������=:ߚKi��}�_O���jH���y��/'�)�1�L1���<�)s������ |W :x �h�&Pk>�n�WRE�S�[��s�iɄ�A9a���ɓۤ�AŌ�4���[-P�Bf O������!p>�[�;�~������dU� �����|5�y�w\�� �:�ʺx�O �U�%�@L�Icn��*V�i�:�Y upq<S�B-���d�غlU)$���f�2�S,W�QR�L�$�V;'&�2�X�t�8K�a�_6C�Z�{�I�I�����g^�u{l�:���5�rj�%���";Q�L��3 ��p�V����T���3��.^"�~n2���m[�Ϥ��� A&���H��'�~�V>�m"�t��?�� �P۷�� �,�.��;�� ��UbPV����c���H�^1��o��'z|���8���鵓��$ӯ%���$�����>�<+#l�I���n=T��9���"��|l�o(Ql;�O+�E��C���nɵ�Kև�ƪ٭�Af�&@� �����8F������g�v�cМu�͘)a%qKo�0��w��K!�Uˇ��6��;:�����]d�g*��e4Bd�h����;�Nf���{$�Yvb�~�����K�ۂ=/��g7�-���q�^�̼3�Q}ɶ�1���}yZ�� �OA���]*���^剂�` �"�^Gh����SdV�D^1N~ӛc��`�n������A���qM�~rp� s����� *� u�? w�SAOsv��Ү�m�c�����\k��VΥ�M� �_�]Y7�|X�)���?�-�;֓��Xm�ׯ@��kH��n����%�<Jg6j�C:$x�<��3�A���ԝdc901��d9X�C���uq �y���r��D4ˈfU�� dAb� �#��\�c��/�)���OlnE-�i̙�+F/y��F?qe������ۚ>H�KyÇ�f����̫4����� Pnޭ��6Ԉk�܌cD�}�@J7�R�N����j���LIl� m���"{��/��;��K۹R��,�P@�9ф9�G)Ǹ� &���I�n3geȽ}V����E3}͙؇��s8v�k��DQ�]�� ����g��lҌ�Ю�/_�|%E��F��I�uJ ��~��Ŗw!���<�y!�~9���aSY��pb�o�/M�ෟO�3Y��+S)垵��|>�p}`�m�B|��%��ET��So9��[����5~P��b���ڪ���W�RKσ.���Y#���:5�����| <ɳ�~PO���d�2�2N�� U�h^-R�S���^�<�����Ր�܊&A�Q<�W%� )�_�%e\{�����9�a� ��Z$�por�̎�g��a>��&?އ:(}� T��q|���l���.],��]DD���5 r����xj�/M=e��9�tM��l�|�~Rp�%a%}:lj<�n�5�����y����"}/�d��;l��w��p�|R�K�4�nc�6�KPI�80.?Gz�|۾*ӌ����ʻ"�0�ԑ B���Џ���7��?_�F���텳05~ۓ��@��Wx��v** �h#�@�cL��у(hd|����1V��5R�nl~�$�|��'2���oCվ67[�C.��f#�{�l�*a�5_��_ �ޕ�-¶�n1+�7����bU�:��¢����H$�# �o[���M��?�n�G �5^D�\=,�bi7C�� ��$9"%t9D�b[^�� ԝ�,m��?sT2�C��]w/k��QX�+�y��&^��#g�OƗ��N�7f)�#�8�U�>�� �2<�/ڤ�aO��XqI0^�ְ�@!J� +w�&{��C�}�ְ��Ü�1���vN���O]}π�ߚY�R^j�Ά�:�S�>'��׳����:<s�X�������� �i˳b(�G�|�Af�S�]:A��%n��/��vN��Wl�O��Diҁ�]�s�gKW�͢�%��z����o=����"��Q�s]��8�<� x�'dۢ�_��c��p�x�>�+Z��|�]�����V�z������գ��]H ��)8˥��p��z,�IV f$�F�į�����u �bt[n�^�H!�C�k��ո��G9��P]�{џ\;�9̓K��p���/Ԗ~;���r qr�g�� h���j�;q� �{Z $��sg���H�c%�xP�j<'⇃�v�3w�}�d�E�pq���~�W4_F+2,<��4�K�j��/�K�KQj�ؾn�V���拃ǡZ(��� ��J���R ��P?!�1o&�'�A#�)ì ���8��变�^sc>��A˻ b@���:���=2W��ҘU���ً<��8 R^BN&��2.E�Էg�Sn~r��q�OD8��xn�����_4m@��� j��UX7�+1r���텳�q�l���K^�pLӈp����"S��{H+e�hs��)g���u�b��1zK��r��=���:�ho���*��Fg��ChBl��y�o��{"Ds��4 �,*s�i�M��,(е�w�����m� ��-y� cM�J��ޛ 3;�cJ3�mZ��SAt�Or�� �O����8ڳ>I"���Pw��06h< ��C��d:�A;��Cg2��5[���GwtR��Q���Q����]B*��!�<ژݡ���E'�Y�<M �8���� �ZC�e�z(��*8�w����6 ��4��\Q��<N*��ׅJ�\��x��yN]l[�kӏ0�$�)д������A�� hc/���ڻz8��%�x��N]�@��&֭�J��'��2�?��fu�T;���/R�V-��7�cn1+� ���;R�#x���[q����^�w]�94�J7�X� L�R%��8JSF1��+�T������ZNC֎���aX�N\vYt�y�Y뚝S���ɔ<h�����;?TS!%A�SAY�s�;�o�x�QQ�%�vQ�^�j[��o�W٩��U���I��b�)����h�ӮF!a��ʩ�Va������T%G�n�;�m2��!gz��b�_{ہo��Ж��I9��۶�d�Zp#p[B,9(ЇN<t���~h|��e���HѫM��������^z%c�x���v�2��Y)�ѹ*(j��ĺ�%�yq�v!̢�I,W��婡�c#�@S�K��1ߺ5ژ�x��������K���E�Fp��T[_�O�Sr�SW�=�J�B ui j>� ��AsC�ۚg���?��L�]��;�!���.���ޗ��u��&�4��Ѿ�u� ��g�o�+V�O�T�w�.�2���M� �oT"5i����c�CmQB!�v�HE���O�hj�ZR��!"~;�M���>�,���`{�+���䭮�t����B#Z.0<GM#P��eF��u�8 ��ԎiV���g�7�(���y��n�����c ���ր���n�vlI�;��w��J�������Þ���!��.o2��X1���K �ym�}�ew"�J1�ί�u��&(���#�����?�_��{�� vc ����B�tFɊ� ��`'�v'w�E� ��_;d��5Yxؑ/�������X;���*�\�L��35��cWR���e�ޢ$s�ګ}o;6�N?n�n?j�Zh�[|Xdu�2c��F�W�`bP����HDmu��D�1�~g>Q�(o������u�� �_��d���GD���٤\A]{=�++��XpC ���8 Io��@�8�N�} 9�2�j'^"�&���ȝ���Ͻ��*+.l���#ץ��n��%o��+N��l�Y���㼨�ϙ"b}��..�UX�Bھ���#7v)�JSX���j���`�5;xv�����(���~����� ��:��\�@�w� s52��Yvicҵ<�aˋ��$=��ɾv�v��l-~�l��1�a^�'����\mV�Ձ��Vk�S:oހ��ůp�|[dV�7w1Or����H�p���UI'r p��h��ˋR^�������݇��W? �sO�5}J��� ���>$e!�Ԇ��žK�a��X�3�+�25!�#&;�l���-�,�J6�=����}q{�q �5¢t�j��{#f <h=τ�p?C��+%�7�It�@8H�h8�HV3�:k¢��v��4���; ��g��d����Yn��1�<J�{��l�QΓ�wt�ay�@@K0��f����}3f��|���?`�I`=�%b��)M� �&f:% �rk�nM͠s�4��V�i_�en7b}��E��X�M1G�|~U���V�C���P X5VT��r��\���J7�s>��-e����l��k?N��p���Nxg*b{s;�Ϗ�Q�9�q��%j {/h%�VT��^ ���� ($��}�����\�q��ֱ�e�����-v� b��.�^ v=�f0ɾ�=��w�٥�[`��6�Ũ��M;��'a�k u$�m� %y�79����G���",��U&�YNѓ9�JUQ2.�Fc���u4lH���Ο��L!$�m^꠩�9��r�x�ΨD��� ����#;H�P���]u�3��øY�'�L/}k���|���s痀�)� :�=����fN=[��,I���̀#�nq�sy �_�%��!�����"eW#j�<Oֻd��.@V�iu�0�|$��]���fڗ?혱��������ɊG�F��w*��&� �Q4t�Z5K�{�a��[l���=����K4h�������k��@ Ά�-`��1����Oq�c�{RX8��� N�(s�DZ��*����5��z>ǂ����{ii�R֚22�i���mY��D��i��hP�B.��c��PW�O�"�������p9,��k�}�h^{���z�?��ޙ �.���|Mϧ9G���.e�x(�0r��6��")��IcJl������[Wn�����]��Y �Axj&�u�D�3r�b&��K���Z�f^����:����H~�,"� y�+}�ڈrvy��W��?e��db�wFG���j���d��,�\bД-Y�]%NC�y��n���Ѯ$^��_:'��Vm�\g�P�˭qړ�����k� 5[f���%'stqߪ�B��8�:�C�'s(�D��(���ۻ��L�i4��U'lK7fP�#|i��B��k$��a$Z�<}sp�^�e^$�Y��̑6��Ѭ�QiH8�1�jI�/4B�/��74���b�Ϊ��A5YD���/!�8i����p�-o^uCuJ�f��c�2����?ʟR*Y�j�t�."��������Z-N�N�grLU���g�\�m�v"~Wo�"���+�����q,��gT�E�iR�1�:Z"�i�&�Dz̜�M� \�>�����t���s�Tƶ�e5� "�u�P� ������1�g�p<v���6.�R�?x��1�3ѻ)��m�ͻ܋ G,�lG���M@=j�a\�s��,le7E;i|��v.�Ld���jZ�s���Hvz��xN� ��Tl�~���0 �UzgG�`;���*W^[�XH�{�Nb��rW���n�h��FdfYF�!�@� �M�{��ٱK)g��ʻI�r:��'1�>�%�p��uĹ��FE��d��C�]~ɡ�\n���n!Mv�*�B|tdS!�J�����0��W�Q7� �n �z�M>g[@{�<U��"M��|���AI����W��^m����"� U�P��~r�fQB�����'�!:mW�Ѳ�/6̽�!?��/�N�q�B��Z�o�xeY��� �@)�e$���.WPK #1�Z ��� system_tests_sync/.gitignorenu �[��� data secrets.tarPK #1�Z�1�O� � system_tests_sync/test_grpc.pynu �[��� # Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import google.auth import google.auth.credentials import google.auth.jwt import google.auth.transport.grpc from google.oauth2 import service_account from google.cloud import pubsub_v1 def test_grpc_request_with_regular_credentials(http_request): credentials, project_id = google.auth.default() credentials = google.auth.credentials.with_scopes_if_required( credentials, scopes=["https://www.googleapis.com/auth/pubsub"] ) # Create a pub/sub client. client = pubsub_v1.PublisherClient(credentials=credentials) # list the topics and drain the iterator to test that an authorized API # call works. list_topics_iter = client.list_topics(project="projects/{}".format(project_id)) list(list_topics_iter) def test_grpc_request_with_regular_credentials_and_self_signed_jwt(http_request): credentials, project_id = google.auth.default() # At the time this test is being written, there are no GAPIC libraries # that will trigger the self-signed JWT flow. Manually create the self-signed # jwt on the service account credential to check that the request # succeeds. credentials = credentials.with_scopes( scopes=[], default_scopes=["https://www.googleapis.com/auth/pubsub"] ) credentials._create_self_signed_jwt(audience="https://pubsub.googleapis.com/") # Create a pub/sub client. client = pubsub_v1.PublisherClient(credentials=credentials) # list the topics and drain the iterator to test that an authorized API # call works. list_topics_iter = client.list_topics(project="projects/{}".format(project_id)) list(list_topics_iter) # Check that self-signed JWT was created and is being used assert credentials._jwt_credentials is not None assert credentials._jwt_credentials.token == credentials.token def test_grpc_request_with_jwt_credentials(): credentials, project_id = google.auth.default() audience = "https://pubsub.googleapis.com/google.pubsub.v1.Publisher" credentials = google.auth.jwt.Credentials.from_signing_credentials( credentials, audience=audience ) # Create a pub/sub client. client = pubsub_v1.PublisherClient(credentials=credentials) # list the topics and drain the iterator to test that an authorized API # call works. list_topics_iter = client.list_topics(project="projects/{}".format(project_id)) list(list_topics_iter) def test_grpc_request_with_on_demand_jwt_credentials(): credentials, project_id = google.auth.default() credentials = google.auth.jwt.OnDemandCredentials.from_signing_credentials( credentials ) # Create a pub/sub client. client = pubsub_v1.PublisherClient(credentials=credentials) # list the topics and drain the iterator to test that an authorized API # call works. list_topics_iter = client.list_topics(project="projects/{}".format(project_id)) list(list_topics_iter) PK #1�Z�?D D "