uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f4a9d3c04e9352bf1656a35c | train | function | def test_iam_host_with_port():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(api_endpoint='iam.googleapis.com:8000'),
)
assert client.transport._host == 'iam.googleapis.com:8000'
| def test_iam_host_with_port():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(api_endpoint='iam.googleapis.com:8000'),
)
assert client.transport._host == 'iam.googleapis.com:8000'
| )
def test_iam_host_no_port():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(api_endpoint='iam.googleapis.com'),
)
assert client.transport._host == 'iam.googleapis.com:443'
def test_iam_host_with_port():
| 64 | 64 | 58 | 8 | 56 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_host_with_port | test_iam_host_with_port | 7,046 | 7,051 | 7,046 | 7,046 | ae1ea23d6e6a8a96904d613faa195f9851edebfe | bigcode/the-stack | train |
9cc66091f40885e42c9db71a | train | function | def test_delete_role(transport: str = 'grpc', request_type=iam.DeleteRoleRequest):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API... | def test_delete_role(transport: str = 'grpc', request_type=iam.DeleteRoleRequest):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
... | 101 | 101 | 338 | 20 | 81 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_delete_role | test_delete_role | 5,924 | 5,963 | 5,924 | 5,924 | bffb397bcb372e10a684bb5230bc116deb593ce7 | bigcode/the-stack | train |
c269033209f902b24a90b5be | train | function | @pytest.mark.asyncio
async def test_list_service_accounts_flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
... | @pytest.mark.asyncio
async def test_list_service_accounts_flattened_error_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.list_service_accounts(
iam.ListServiceAccountsRequest()... | that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].name == 'name_value'
@pytest.mark.asyncio
async def test_list_service_accounts_flattened_error_async():
| 64 | 64 | 87 | 17 | 47 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_service_accounts_flattened_error_async | test_list_service_accounts_flattened_error_async | 613 | 625 | 613 | 614 | 05e4adac11d169e601d60b6ef1ad2a7df325982d | bigcode/the-stack | train |
d25a89ab79dbb5962294fcf4 | train | function | @pytest.mark.asyncio
async def test_sign_blob_flattened_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.sign_blob),
'__... | @pytest.mark.asyncio
async def test_sign_blob_flattened_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.sign_blob),
'__call__') as call:
# Designate an appropriate return value... | a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.sign_blob(
iam.SignBlobRequest(),
name='name_value',
bytes_to_sign=b'bytes_to_sign_blob',
)
@pytest.mark.asyncio
async def test_sign_blob_flattened_... | 69 | 69 | 231 | 15 | 54 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_blob_flattened_async | test_sign_blob_flattened_async | 3,737 | 3,763 | 3,737 | 3,738 | ac2d0b897b221aa5a6fa592e4d297c650fed9af9 | bigcode/the-stack | train |
b25fac741d24564c026b3286 | train | function | @pytest.mark.asyncio
async def test_set_iam_policy_async_from_dict():
await test_set_iam_policy_async(request_type=dict)
| @pytest.mark.asyncio
async def test_set_iam_policy_async_from_dict():
| await test_set_iam_policy_async(request_type=dict)
| 2.SetIamPolicyRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, policy_pb2.Policy)
assert response.version == 774
assert response.etag == b'etag_blob'
@pytest.mark.asyncio
async def test_set_iam_policy_async_from_dict():
| 64 | 64 | 28 | 16 | 48 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_set_iam_policy_async_from_dict | test_set_iam_policy_async_from_dict | 4,362 | 4,364 | 4,362 | 4,363 | 8e1ca096bfb17aa2a700fe2cdd778417fb9f6366 | bigcode/the-stack | train |
85ef981afe9a87525a3ea2eb | train | function | def test_query_testable_permissions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock ... | def test_query_testable_permissions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.query_testable_permissions),
'__call__') as call:
c... | _token_value'
def test_query_testable_permissions_from_dict():
test_query_testable_permissions(request_type=dict)
def test_query_testable_permissions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 142 | 42 | 22 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_testable_permissions_empty_call | test_query_testable_permissions_empty_call | 6,308 | 6,323 | 6,308 | 6,310 | fb4d08319cfcef87552a4365152b785001697dd4 | bigcode/the-stack | train |
15bfeec941f64fb17822994a | train | function | def test_iam_base_transport_error():
# Passing both a credentials object and credentials_file should raise an error
with pytest.raises(core_exceptions.DuplicateCredentialArgs):
transport = transports.IAMTransport(
credentials=ga_credentials.AnonymousCredentials(),
credentials_fil... | def test_iam_base_transport_error():
# Passing both a credentials object and credentials_file should raise an error
| with pytest.raises(core_exceptions.DuplicateCredentialArgs):
transport = transports.IAMTransport(
credentials=ga_credentials.AnonymousCredentials(),
credentials_file="credentials.json"
)
| the gRPC transport by default.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
assert isinstance(
client.transport,
transports.IAMGrpcTransport,
)
def test_iam_base_transport_error():
# Passing both a credentials object and credentials_file should ra... | 64 | 64 | 61 | 23 | 41 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_base_transport_error | test_iam_base_transport_error | 6,786 | 6,792 | 6,786 | 6,787 | 58c7bbeea7dabc58e3d004e4e825c9d6ec12cf36 | bigcode/the-stack | train |
a017ec49489102b8e221c456 | train | function | @pytest.mark.asyncio
async def test_get_service_account_key_flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
... | @pytest.mark.asyncio
async def test_get_service_account_key_flattened_error_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.get_service_account_key(
iam.GetServiceAccountKeyReques... | _, args, _ = call.mock_calls[0]
assert args[0].name == 'name_value'
assert args[0].public_key_type == iam.ServiceAccountPublicKeyType.TYPE_X509_PEM_FILE
@pytest.mark.asyncio
async def test_get_service_account_key_flattened_error_async():
| 64 | 64 | 108 | 18 | 45 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_key_flattened_error_async | test_get_service_account_key_flattened_error_async | 2,858 | 2,871 | 2,858 | 2,859 | 36cbaaeb2b3de307c5c5c38f2ae20aceded8c363 | bigcode/the-stack | train |
4c5e36b7a1386edb201f4f42 | train | function | def test_list_roles_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call ... | def test_list_roles_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_roles),
'__call__') as call:
client.list_roles... | _page_token == 'next_page_token_value'
def test_list_roles_from_dict():
test_list_roles(request_type=dict)
def test_list_roles_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 134 | 40 | 24 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_roles_empty_call | test_list_roles_empty_call | 5,164 | 5,179 | 5,164 | 5,166 | 667fcdb7ca7bdcbd78b9c669b044b2edf1cfe8eb | bigcode/the-stack | train |
66dcaef0bcc81a981dad8f68 | train | function | def test_common_project_path():
project = "oyster"
expected = "projects/{project}".format(project=project, )
actual = IAMClient.common_project_path(project)
assert expected == actual
| def test_common_project_path():
| project = "oyster"
expected = "projects/{project}".format(project=project, )
actual = IAMClient.common_project_path(project)
assert expected == actual
| _organization_path():
expected = {
"organization": "octopus",
}
path = IAMClient.common_organization_path(**expected)
# Check that the path construction is reversible.
actual = IAMClient.parse_common_organization_path(path)
assert expected == actual
def test_common_project_path():
| 64 | 64 | 43 | 6 | 57 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_common_project_path | test_common_project_path | 7,254 | 7,258 | 7,254 | 7,254 | 910eb25a41fd3f1277929fb916b6f9a4fb93c1a5 | bigcode/the-stack | train |
2dc3a8da4dc0af403dfc96e9 | train | function | def test_list_roles_from_dict():
test_list_roles(request_type=dict)
| def test_list_roles_from_dict():
| test_list_roles(request_type=dict)
| _ = call.mock_calls[0]
assert args[0] == iam.ListRolesRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListRolesPager)
assert response.next_page_token == 'next_page_token_value'
def test_list_roles_from_dict():
| 64 | 64 | 15 | 7 | 57 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_roles_from_dict | test_list_roles_from_dict | 5,160 | 5,161 | 5,160 | 5,160 | 09428d672d136f0505de1bfb13d1e62e3235b615 | bigcode/the-stack | train |
92aea4a8fb89596c59437aa8 | train | function | def test_set_iam_policy_from_dict():
test_set_iam_policy(request_type=dict)
| def test_set_iam_policy_from_dict():
| test_set_iam_policy(request_type=dict)
| [0] == iam_policy_pb2.SetIamPolicyRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, policy_pb2.Policy)
assert response.version == 774
assert response.etag == b'etag_blob'
def test_set_iam_policy_from_dict():
| 64 | 64 | 19 | 9 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_set_iam_policy_from_dict | test_set_iam_policy_from_dict | 4,307 | 4,308 | 4,307 | 4,307 | 6537c61cc962a64c533bb21e1cb3c4f4ae07a838 | bigcode/the-stack | train |
93315296a00da7b08d80bd5d | train | function | @pytest.mark.asyncio
async def test_create_service_account_async_from_dict():
await test_create_service_account_async(request_type=dict)
| @pytest.mark.asyncio
async def test_create_service_account_async_from_dict():
| await test_create_service_account_async(request_type=dict)
| _name == 'display_name_value'
assert response.etag == b'etag_blob'
assert response.description == 'description_value'
assert response.oauth2_client_id == 'oauth2_client_id_value'
assert response.disabled is True
@pytest.mark.asyncio
async def test_create_service_account_async_from_dict():
| 64 | 64 | 26 | 15 | 48 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_create_service_account_async_from_dict | test_create_service_account_async_from_dict | 1,192 | 1,194 | 1,192 | 1,193 | ed156d0923d7143e3412564d03f8d220e8153bab | bigcode/the-stack | train |
52e27396bda5492a7728e455 | train | function | @pytest.mark.parametrize(
"transport_class",
[
transports.IAMGrpcTransport,
transports.IAMGrpcAsyncIOTransport,
],
)
@requires_google_auth_lt_1_25_0
def test_iam_transport_auth_adc_old_google_auth(transport_class):
# If credentials and host are not provided, the transport class should us... | @pytest.mark.parametrize(
"transport_class",
[
transports.IAMGrpcTransport,
transports.IAMGrpcAsyncIOTransport,
],
)
@requires_google_auth_lt_1_25_0
def test_iam_transport_auth_adc_old_google_auth(transport_class):
# If credentials and host are not provided, the transport class should us... | with mock.patch.object(google.auth, "default", autospec=True) as adc:
adc.return_value = (ga_credentials.AnonymousCredentials(), None)
transport_class(quota_project_id="octopus")
adc.assert_called_once_with(scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
... | @pytest.mark.parametrize(
"transport_class",
[
transports.IAMGrpcTransport,
transports.IAMGrpcAsyncIOTransport,
],
)
@requires_google_auth_lt_1_25_0
def test_iam_transport_auth_adc_old_google_auth(transport_class):
# If credentials and host are not provided, the transport class should us... | 77 | 64 | 153 | 77 | 0 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_transport_auth_adc_old_google_auth | test_iam_transport_auth_adc_old_google_auth | 6,937 | 6,955 | 6,937 | 6,947 | 04b48b8c51a4e49b1cb4e8107f4701913a94f689 | bigcode/the-stack | train |
c2a3a38a31153f3c4788ab90 | train | function | def test_query_testable_permissions_pager():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.query_testable_permissions),
'__call__') a... | def test_query_testable_permissions_pager():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.query_testable_permissions),
'__call__') as call:
# Set the response to a serie... | Establish that the response is the type that we expect.
assert isinstance(response, pagers.QueryTestablePermissionsAsyncPager)
assert response.next_page_token == 'next_page_token_value'
@pytest.mark.asyncio
async def test_query_testable_permissions_async_from_dict():
await test_query_testable_permissions... | 75 | 75 | 251 | 9 | 66 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_testable_permissions_pager | test_query_testable_permissions_pager | 6,362 | 6,408 | 6,362 | 6,362 | fcd3c89ee2dda9a835d84df32818d5c3dcfec6a1 | bigcode/the-stack | train |
4cfea8e58af6ab35f9a4f63a | train | function | def test_get_service_account_flattened():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_service_account),
'__call__') as call:
... | def test_get_service_account_flattened():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_service_account),
'__call__') as call:
# Designate an appropriate return ... | assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
def test_get_service_account_flattened():
| 64 | 64 | 179 | 9 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_flattened | test_get_service_account_flattened | 997 | 1,018 | 997 | 997 | cffdb33458828f83c018df6c5c5f9e68b5530d6e | bigcode/the-stack | train |
4ea7c6204424fb16823dc3c6 | train | function | @pytest.mark.asyncio
async def test_undelete_service_account_field_headers_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.Un... | @pytest.mark.asyncio
async def test_undelete_service_account_field_headers_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.UndeleteServiceAccountRequest()
request.name = 'name/value'
# Mock the actua... | 0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
@pytest.mark.asyncio
async def test_undelete_service_account_field_headers_async():
| 74 | 74 | 248 | 17 | 57 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_undelete_service_account_field_headers_async | test_undelete_service_account_field_headers_async | 2,058 | 2,087 | 2,058 | 2,059 | e037bd67914e965c6cb08de908a634a1ec06c9ca | bigcode/the-stack | train |
95da07df692ef44869ff1929 | train | function | def test_sign_blob_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call w... | def test_sign_blob_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.sign_blob),
'__call__') as call:
client.sign_blob()... | response.signature == b'signature_blob'
def test_sign_blob_from_dict():
test_sign_blob(request_type=dict)
def test_sign_blob_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 134 | 40 | 24 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_blob_empty_call | test_sign_blob_empty_call | 3,577 | 3,592 | 3,577 | 3,579 | 03cfef0f06d6afb1e240e2e227d4876307e28459 | bigcode/the-stack | train |
b4092e35288d10e7f22b2644 | train | function | def test_get_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the act... | def test_get_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_service_account),
'__call__') as call:
client.g... | assert response.disabled is True
def test_get_service_account_from_dict():
test_get_service_account(request_type=dict)
def test_get_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 138 | 41 | 23 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_empty_call | test_get_service_account_empty_call | 864 | 879 | 864 | 866 | 9baeb840cb2490b1cba6f9dd7920916602537e80 | bigcode/the-stack | train |
814e7c00534e5467774845bf | train | function | @pytest.mark.asyncio
async def test_get_role_async_from_dict():
await test_get_role_async(request_type=dict)
| @pytest.mark.asyncio
async def test_get_role_async_from_dict():
| await test_get_role_async(request_type=dict)
| response.description == 'description_value'
assert response.included_permissions == ['included_permissions_value']
assert response.stage == iam.Role.RoleLaunchStage.BETA
assert response.etag == b'etag_blob'
assert response.deleted is True
@pytest.mark.asyncio
async def test_get_role_async_from_dict():
| 64 | 64 | 24 | 14 | 49 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_role_async_from_dict | test_get_role_async_from_dict | 5,506 | 5,508 | 5,506 | 5,507 | d4f840e3b80651fc4c61ab9905ce81f7c3b95461 | bigcode/the-stack | train |
a008ff881e3c70a87a082610 | train | function | @pytest.mark.asyncio
async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=iam.SignBlobRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
... | @pytest.mark.asyncio
async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=iam.SignBlobRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | with mock.patch.object(
type(client.transport.sign_blob),
'__call__') as call:
client.sign_blob()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == iam.SignBlobRequest()
@pytest.mark.asyncio
async def test_sign_blob_async(transport: str = 'gr... | 83 | 83 | 277 | 29 | 54 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_blob_async | test_sign_blob_async | 3,595 | 3,625 | 3,595 | 3,596 | 664afe6b5953ca7182c9ee8b665c51d56c862156 | bigcode/the-stack | train |
5d078578874269de50e5e753 | train | function | def test_common_folder_path():
folder = "squid"
expected = "folders/{folder}".format(folder=folder, )
actual = IAMClient.common_folder_path(folder)
assert expected == actual
| def test_common_folder_path():
| folder = "squid"
expected = "folders/{folder}".format(folder=folder, )
actual = IAMClient.common_folder_path(folder)
assert expected == actual
| ():
expected = {
"billing_account": "abalone",
}
path = IAMClient.common_billing_account_path(**expected)
# Check that the path construction is reversible.
actual = IAMClient.parse_common_billing_account_path(path)
assert expected == actual
def test_common_folder_path():
| 64 | 64 | 43 | 6 | 57 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_common_folder_path | test_common_folder_path | 7,220 | 7,224 | 7,220 | 7,220 | 6268f856be1bc0dc6388caea6a77f79ae83b68da | bigcode/the-stack | train |
47c637fd4261add5af830678 | train | function | @pytest.mark.asyncio
async def test_disable_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.DisableServiceAccountRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as ... | @pytest.mark.asyncio
async def test_disable_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.DisableServiceAccountRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | as call:
client.disable_service_account()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == iam.DisableServiceAccountRequest()
@pytest.mark.asyncio
async def test_disable_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.DisableServiceAccountRe... | 70 | 70 | 234 | 31 | 39 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_disable_service_account_async | test_disable_service_account_async | 2,284 | 2,309 | 2,284 | 2,285 | ca53180f9810fbe2df6544871def6071e75a55ff | bigcode/the-stack | train |
3acad59ebc683d8f26327827 | train | function | @pytest.mark.asyncio
async def test_patch_service_account_async_from_dict():
await test_patch_service_account_async(request_type=dict)
| @pytest.mark.asyncio
async def test_patch_service_account_async_from_dict():
| await test_patch_service_account_async(request_type=dict)
| _name == 'display_name_value'
assert response.etag == b'etag_blob'
assert response.description == 'description_value'
assert response.oauth2_client_id == 'oauth2_client_id_value'
assert response.disabled is True
@pytest.mark.asyncio
async def test_patch_service_account_async_from_dict():
| 64 | 64 | 26 | 15 | 48 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_patch_service_account_async_from_dict | test_patch_service_account_async_from_dict | 1,650 | 1,652 | 1,650 | 1,651 | 524cb3b5aef6a102df820f3fdc3b1dd1d9d1f0dd | bigcode/the-stack | train |
efc962e46515958ef374c6f6 | train | function | @pytest.mark.asyncio
async def test_create_service_account_key_async_from_dict():
await test_create_service_account_key_async(request_type=dict)
| @pytest.mark.asyncio
async def test_create_service_account_key_async_from_dict():
| await test_create_service_account_key_async(request_type=dict)
| assert response.public_key_data == b'public_key_data_blob'
assert response.key_origin == iam.ServiceAccountKeyOrigin.USER_PROVIDED
assert response.key_type == iam.ListServiceAccountKeysRequest.KeyType.USER_MANAGED
@pytest.mark.asyncio
async def test_create_service_account_key_async_from_dict():
| 64 | 64 | 28 | 16 | 47 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_create_service_account_key_async_from_dict | test_create_service_account_key_async_from_dict | 2,981 | 2,983 | 2,981 | 2,982 | 72146d7f1eb87ad30d3e8a846dfed804f84a9162 | bigcode/the-stack | train |
ac5f461e2bbb0e67aee189f5 | train | function | def test_iam_grpc_asyncio_transport_channel():
channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials())
# Check that channel is used if provided.
transport = transports.IAMGrpcAsyncIOTransport(
host="squid.clam.whelk",
channel=channel,
)
assert transport.g... | def test_iam_grpc_asyncio_transport_channel():
| channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials())
# Check that channel is used if provided.
transport = transports.IAMGrpcAsyncIOTransport(
host="squid.clam.whelk",
channel=channel,
)
assert transport.grpc_channel == channel
assert transport._ho... | host="squid.clam.whelk",
channel=channel,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
assert transport._ssl_channel_credentials == None
def test_iam_grpc_asyncio_transport_channel():
| 64 | 64 | 102 | 11 | 52 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_grpc_asyncio_transport_channel | test_iam_grpc_asyncio_transport_channel | 7,066 | 7,076 | 7,066 | 7,066 | 9ca314153bdb3bf59b59bcf20d6fe85068ba8f94 | bigcode/the-stack | train |
81bc6b6cf459e5b3a5b34f73 | train | function | @pytest.mark.asyncio
async def test_get_service_account_key_async_from_dict():
await test_get_service_account_key_async(request_type=dict)
| @pytest.mark.asyncio
async def test_get_service_account_key_async_from_dict():
| await test_get_service_account_key_async(request_type=dict)
| assert response.public_key_data == b'public_key_data_blob'
assert response.key_origin == iam.ServiceAccountKeyOrigin.USER_PROVIDED
assert response.key_type == iam.ListServiceAccountKeysRequest.KeyType.USER_MANAGED
@pytest.mark.asyncio
async def test_get_service_account_key_async_from_dict():
| 64 | 64 | 28 | 16 | 47 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_key_async_from_dict | test_get_service_account_key_async_from_dict | 2,720 | 2,722 | 2,720 | 2,721 | 6281b69dd25f1e1e98c61e32ad922fdb9d5ccb76 | bigcode/the-stack | train |
b74da0fb811a082d38292c96 | train | function | def test_delete_role_from_dict():
test_delete_role(request_type=dict)
| def test_delete_role_from_dict():
| test_delete_role(request_type=dict)
| == 'title_value'
assert response.description == 'description_value'
assert response.included_permissions == ['included_permissions_value']
assert response.stage == iam.Role.RoleLaunchStage.BETA
assert response.etag == b'etag_blob'
assert response.deleted is True
def test_delete_role_from_dict():
| 64 | 64 | 15 | 7 | 56 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_delete_role_from_dict | test_delete_role_from_dict | 5,966 | 5,967 | 5,966 | 5,966 | db32060e065ccc3703e8819f0d8f253add11d640 | bigcode/the-stack | train |
b2a74f7ec4f31ad3ed3dbc9d | train | function | def test_query_testable_permissions_from_dict():
test_query_testable_permissions(request_type=dict)
| def test_query_testable_permissions_from_dict():
| test_query_testable_permissions(request_type=dict)
| 0]
assert args[0] == iam.QueryTestablePermissionsRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.QueryTestablePermissionsPager)
assert response.next_page_token == 'next_page_token_value'
def test_query_testable_permissions_from_dict():
| 64 | 64 | 19 | 9 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_testable_permissions_from_dict | test_query_testable_permissions_from_dict | 6,304 | 6,305 | 6,304 | 6,304 | e746ed8d48fcb0dc5a8f621baf2c9cb081a0775d | bigcode/the-stack | train |
5e5a546aa2f332013f734739 | train | function | def test_upload_service_account_key_field_headers():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.UploadServiceAccountKeyRequest()
... | def test_upload_service_account_key_field_headers():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.UploadServiceAccountKeyRequest()
request.name = 'name/value'
# Mock the actual ca... | .key_origin == iam.ServiceAccountKeyOrigin.USER_PROVIDED
assert response.key_type == iam.ListServiceAccountKeysRequest.KeyType.USER_MANAGED
@pytest.mark.asyncio
async def test_upload_service_account_key_async_from_dict():
await test_upload_service_account_key_async(request_type=dict)
def test_upload_service_a... | 68 | 68 | 227 | 9 | 59 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_upload_service_account_key_field_headers | test_upload_service_account_key_field_headers | 3,253 | 3,281 | 3,253 | 3,253 | 24a76fa26ea3d8862fa3aedc5560bff11e12acb7 | bigcode/the-stack | train |
bf8be090d15e7bd99d550442 | train | function | def test_key_path():
project = "squid"
service_account = "clam"
key = "whelk"
expected = "projects/{project}/serviceAccounts/{service_account}/keys/{key}".format(project=project, service_account=service_account, key=key, )
actual = IAMClient.key_path(project, service_account, key)
assert expecte... | def test_key_path():
| project = "squid"
service_account = "clam"
key = "whelk"
expected = "projects/{project}/serviceAccounts/{service_account}/keys/{key}".format(project=project, service_account=service_account, key=key, )
actual = IAMClient.key_path(project, service_account, key)
assert expected == actual
| scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
assert transpor... | 64 | 64 | 80 | 5 | 58 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_key_path | test_key_path | 7,163 | 7,169 | 7,163 | 7,163 | bee55cb3fe09f436aa593a26d1916104af56a43e | bigcode/the-stack | train |
0aba47db33e66cc468b10019 | train | function | @pytest.mark.asyncio
async def test_create_service_account_key_field_headers_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.... | @pytest.mark.asyncio
async def test_create_service_account_key_field_headers_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.CreateServiceAccountKeyRequest()
request.name = 'name/value'
# Mock the actu... | ]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
@pytest.mark.asyncio
async def test_create_service_account_key_field_headers_async():
| 72 | 72 | 241 | 16 | 56 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_create_service_account_key_field_headers_async | test_create_service_account_key_field_headers_async | 3,017 | 3,046 | 3,017 | 3,018 | 431480781f1320e0f45a95ca247e9df1dd8c0cf5 | bigcode/the-stack | train |
bcf39e8229acae07713c18c3 | train | function | def test_get_service_account_key_field_headers():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.GetServiceAccountKeyRequest()
reques... | def test_get_service_account_key_field_headers():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.GetServiceAccountKeyRequest()
request.name = 'name/value'
# Mock the actual call ... | .key_origin == iam.ServiceAccountKeyOrigin.USER_PROVIDED
assert response.key_type == iam.ListServiceAccountKeysRequest.KeyType.USER_MANAGED
@pytest.mark.asyncio
async def test_get_service_account_key_async_from_dict():
await test_get_service_account_key_async(request_type=dict)
def test_get_service_account_ke... | 68 | 68 | 227 | 9 | 59 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_key_field_headers | test_get_service_account_key_field_headers | 2,725 | 2,753 | 2,725 | 2,725 | f1d9961b113040b5dda623ba9315cae5b17c61e4 | bigcode/the-stack | train |
b39ef39b66892ea2c198026f | train | function | @pytest.mark.asyncio
async def test_update_role_async_from_dict():
await test_update_role_async(request_type=dict)
| @pytest.mark.asyncio
async def test_update_role_async_from_dict():
| await test_update_role_async(request_type=dict)
| response.description == 'description_value'
assert response.included_permissions == ['included_permissions_value']
assert response.stage == iam.Role.RoleLaunchStage.BETA
assert response.etag == b'etag_blob'
assert response.deleted is True
@pytest.mark.asyncio
async def test_update_role_async_from_dict(... | 64 | 64 | 24 | 14 | 49 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_update_role_async_from_dict | test_update_role_async_from_dict | 5,856 | 5,858 | 5,856 | 5,857 | e2a203887d4d88da29a4bf4ff40c135d255cfc72 | bigcode/the-stack | train |
bcc31870c5b172093e9d04a4 | train | function | def test_get_iam_policy_from_dict_foreign():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_iam_policy),
'__call__') as call:
... | def test_get_iam_policy_from_dict_foreign():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_iam_policy),
'__call__') as call:
# Designate an appropriate return value ... | [0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'resource=resource/value',
) in kw['metadata']
def test_get_iam_policy_from_dict_foreign():
| 64 | 64 | 135 | 11 | 53 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_iam_policy_from_dict_foreign | test_get_iam_policy_from_dict_foreign | 4,177 | 4,192 | 4,177 | 4,177 | 119769296a3d5bdf7ec6bb4865fba1a40ab958ee | bigcode/the-stack | train |
3f7b02c119742d385b2e06e6 | train | function | def test_upload_service_account_key_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock ... | def test_upload_service_account_key_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.upload_service_account_key),
'__call__') as call:
c... | _MANAGED
def test_upload_service_account_key_from_dict():
test_upload_service_account_key(request_type=dict)
def test_upload_service_account_key_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 142 | 42 | 22 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_upload_service_account_key_empty_call | test_upload_service_account_key_empty_call | 3,187 | 3,202 | 3,187 | 3,189 | 00eff05d5bb804367dbf1c60583acab0c0eba86e | bigcode/the-stack | train |
2c855b1f9b3936e6bbdf98ff | train | function | @requires_google_auth_lt_1_25_0
def test_iam_auth_adc_old_google_auth():
# If no credentials are provided, we should use ADC credentials.
with mock.patch.object(google.auth, 'default', autospec=True) as adc:
adc.return_value = (ga_credentials.AnonymousCredentials(), None)
IAMClient()
adc... | @requires_google_auth_lt_1_25_0
def test_iam_auth_adc_old_google_auth():
# If no credentials are provided, we should use ADC credentials.
| with mock.patch.object(google.auth, 'default', autospec=True) as adc:
adc.return_value = (ga_credentials.AnonymousCredentials(), None)
IAMClient()
adc.assert_called_once_with(
scopes=( 'https://www.googleapis.com/auth/cloud-platform',),
quota_project_id... | =None,
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
quota_project_id=None,
)
@requires_google_auth_lt_1_25_0
def test_iam_auth_adc_old_google_auth():
# If no credentials are provided, we should use ADC credentials.
| 64 | 64 | 103 | 36 | 28 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_auth_adc_old_google_auth | test_iam_auth_adc_old_google_auth | 6,904 | 6,913 | 6,904 | 6,906 | b44d78fb93e650be3f4c346d2629d235add9f343 | bigcode/the-stack | train |
2e7e4a29ce09bdff2f814e72 | train | function | def test_query_auditable_services(transport: str = 'grpc', request_type=iam.QueryAuditableServicesRequest):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are m... | def test_query_auditable_services(transport: str = 'grpc', request_type=iam.QueryAuditableServicesRequest):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | await client.query_testable_permissions(request={})).pages:
pages.append(page_)
for page_, token in zip(pages, ['abc','def','ghi', '']):
assert page_.raw_page.next_page_token == token
def test_query_auditable_services(transport: str = 'grpc', request_type=iam.QueryAuditableServicesReques... | 72 | 72 | 240 | 25 | 46 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_auditable_services | test_query_auditable_services | 6,543 | 6,568 | 6,543 | 6,543 | 99076f8169fde5aae1c1b2bbf7a1974a17c3f608 | bigcode/the-stack | train |
20f15c780a5d281e1d0ba68f | train | function | def test_sign_blob(transport: str = 'grpc', request_type=iam.SignBlobRequest):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so... | def test_sign_blob(transport: str = 'grpc', request_type=iam.SignBlobRequest):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | Credentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.delete_service_account_key(
iam.DeleteServiceAccountKeyRequest(),
name='name_value',
)
def test_sign_blob(tr... | 78 | 78 | 261 | 20 | 58 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_blob | test_sign_blob | 3,541 | 3,570 | 3,541 | 3,541 | 0eb30742eab0bfb1eaa24ee84681ca601d5c7f74 | bigcode/the-stack | train |
6aaaceea9e01164a6350bfb9 | train | function | def test_common_location_path():
project = "cuttlefish"
location = "mussel"
expected = "projects/{project}/locations/{location}".format(project=project, location=location, )
actual = IAMClient.common_location_path(project, location)
assert expected == actual
| def test_common_location_path():
| project = "cuttlefish"
location = "mussel"
expected = "projects/{project}/locations/{location}".format(project=project, location=location, )
actual = IAMClient.common_location_path(project, location)
assert expected == actual
| _parse_common_project_path():
expected = {
"project": "nudibranch",
}
path = IAMClient.common_project_path(**expected)
# Check that the path construction is reversible.
actual = IAMClient.parse_common_project_path(path)
assert expected == actual
def test_common_location_path():
| 64 | 64 | 62 | 6 | 57 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_common_location_path | test_common_location_path | 7,271 | 7,276 | 7,271 | 7,271 | 8857306969772ce4097373ab951da9819a6b2413 | bigcode/the-stack | train |
98e85748059a4e30846aa00a | train | function | @pytest.mark.asyncio
async def test_list_service_accounts_flattened_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_service_ac... | @pytest.mark.asyncio
async def test_list_service_accounts_flattened_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_service_accounts),
'__call__') as call:
# Designate an appropriate ... | ing to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_service_accounts(
iam.ListServiceAccountsRequest(),
name='name_value',
)
@pytest.mark.asyncio
async def test_list_service_accounts_flattened_asy... | 64 | 64 | 208 | 16 | 48 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_service_accounts_flattened_async | test_list_service_accounts_flattened_async | 586 | 610 | 586 | 587 | a35e976711f3241e8f192b2beac1082533c38c41 | bigcode/the-stack | train |
972331ee9cc0570351628e82 | train | function | @pytest.mark.parametrize("transport_class", [transports.IAMGrpcTransport, transports.IAMGrpcAsyncIOTransport])
def test_iam_grpc_transport_client_cert_source_for_mtls(
transport_class
):
cred = ga_credentials.AnonymousCredentials()
# Check ssl_channel_credentials is used if provided.
with mock.patch.ob... | @pytest.mark.parametrize("transport_class", [transports.IAMGrpcTransport, transports.IAMGrpcAsyncIOTransport])
def test_iam_grpc_transport_client_cert_source_for_mtls(
transport_class
):
| cred = ga_credentials.AnonymousCredentials()
# Check ssl_channel_credentials is used if provided.
with mock.patch.object(transport_class, "create_channel") as mock_create_channel:
mock_ssl_channel_creds = mock.Mock()
transport_class(
host="squid.clam.whelk",
credenti... | /auth/cloud-platform',
),
scopes=["1", "2"],
default_host="iam.googleapis.com",
ssl_credentials=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
@pytest.mark.parametrize... | 97 | 97 | 324 | 42 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_grpc_transport_client_cert_source_for_mtls | test_iam_grpc_transport_client_cert_source_for_mtls | 6,996 | 7,035 | 6,996 | 6,999 | 1375512f7d90b3b3d2f18acbd38fd8acfc6bc25f | bigcode/the-stack | train |
88b372848e7e2e5d8ec67aa9 | train | function | def test_list_service_accounts_field_headers():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.ListServiceAccountsRequest()
request.n... | def test_list_service_accounts_field_headers():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.ListServiceAccountsRequest()
request.name = 'name/value'
# Mock the actual call w... | is the type that we expect.
assert isinstance(response, pagers.ListServiceAccountsAsyncPager)
assert response.next_page_token == 'next_page_token_value'
@pytest.mark.asyncio
async def test_list_service_accounts_async_from_dict():
await test_list_service_accounts_async(request_type=dict)
def test_list_ser... | 67 | 67 | 224 | 8 | 59 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_service_accounts_field_headers | test_list_service_accounts_field_headers | 485 | 513 | 485 | 485 | c8bc095b6db78225ff12d36430a58e3f79a89c11 | bigcode/the-stack | train |
78b354db1f5f0dc564aa7081 | train | function | @pytest.mark.asyncio
async def test_get_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.GetServiceAccountRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runt... | @pytest.mark.asyncio
async def test_get_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.GetServiceAccountRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | =ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_service_account),
'__call__') as call:
client.get_service_account()
call.assert_ca... | 120 | 120 | 401 | 31 | 89 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_async | test_get_service_account_async | 882 | 926 | 882 | 883 | 8e106b4bc14c77c191ea1633cd0c4cbde2c69874 | bigcode/the-stack | train |
152c4af478f578ac96b7ab3a | train | function | def test_get_service_account_key_flattened_error():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_service_account_key(
... | def test_get_service_account_key_flattened_error():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_service_account_key(
iam.GetServiceAccountKeyRequest(),
... | _calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0].name == 'name_value'
assert args[0].public_key_type == iam.ServiceAccountPublicKeyType.TYPE_X509_PEM_FILE
def test_get_service_account_key_flattened_error():
| 64 | 64 | 99 | 11 | 52 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_key_flattened_error | test_get_service_account_key_flattened_error | 2,814 | 2,826 | 2,814 | 2,814 | 3347f70df149f31989f6c6a144c9039a4dc7a534 | bigcode/the-stack | train |
c3725eeda2ccbcd9ba5140e7 | train | function | def test_test_iam_permissions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the ac... | def test_test_iam_permissions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.test_iam_permissions),
'__call__') as call:
client.... | permissions_value']
def test_test_iam_permissions_from_dict():
test_test_iam_permissions(request_type=dict)
def test_test_iam_permissions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 144 | 42 | 22 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_test_iam_permissions_empty_call | test_test_iam_permissions_empty_call | 4,561 | 4,576 | 4,561 | 4,563 | 0f14a42560013ca5b2cdaf7975e7dcd2a89d8a49 | bigcode/the-stack | train |
c3afaaf2fb8571bc16b8c0c3 | train | function | @pytest.mark.asyncio
async def test_list_service_account_keys_field_headers_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.L... | @pytest.mark.asyncio
async def test_list_service_account_keys_field_headers_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.ListServiceAccountKeysRequest()
request.name = 'name/value'
# Mock the actua... | ]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
@pytest.mark.asyncio
async def test_list_service_account_keys_field_headers_async():
| 72 | 72 | 243 | 16 | 56 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_service_account_keys_field_headers_async | test_list_service_account_keys_field_headers_async | 2,495 | 2,524 | 2,495 | 2,496 | 4aa893385b24d9216c3dc1416aeede7b00fd4eed | bigcode/the-stack | train |
0d1a7261e872274666aff3b1 | train | function | @pytest.mark.asyncio
async def test_delete_role_field_headers_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.DeleteRoleReque... | @pytest.mark.asyncio
async def test_delete_role_field_headers_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.DeleteRoleRequest()
request.name = 'name/value'
# Mock the actual call withi... | assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
@pytest.mark.asyncio
async def test_delete_role_field_headers_async():
| 69 | 69 | 231 | 14 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_delete_role_field_headers_async | test_delete_role_field_headers_async | 6,067 | 6,096 | 6,067 | 6,068 | d2c1139fe731c6882a4adca40ea6cacce95ef069 | bigcode/the-stack | train |
e35a5047b2be94537d362865 | train | function | def test_undelete_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock th... | def test_undelete_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.undelete_service_account),
'__call__') as call:
cli... | def test_undelete_service_account_from_dict():
test_undelete_service_account(request_type=dict)
def test_undelete_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 146 | 43 | 21 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_undelete_service_account_empty_call | test_undelete_service_account_empty_call | 1,975 | 1,990 | 1,975 | 1,977 | 925da28435824b7187fa343ade393fdb5c5e7569 | bigcode/the-stack | train |
8130fc8043d3ec5bccdb3c77 | train | function | def test_undelete_role_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual ca... | def test_undelete_role_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.undelete_role),
'__call__') as call:
client.undelet... | is True
def test_undelete_role_from_dict():
test_undelete_role(request_type=dict)
def test_undelete_role_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 142 | 42 | 22 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_undelete_role_empty_call | test_undelete_role_empty_call | 6,145 | 6,160 | 6,145 | 6,147 | a8f76f67864ba072cd7e9491ed2a07865c101050 | bigcode/the-stack | train |
d850bb5ddff857234f6bfb62 | train | function | @pytest.mark.asyncio
async def test_set_iam_policy_flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
awai... | @pytest.mark.asyncio
async def test_set_iam_policy_flattened_error_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.set_iam_policy(
iam_policy_pb2.SetIamPolicyRequest(),
... | the underlying call was made with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].resource == 'resource_value'
@pytest.mark.asyncio
async def test_set_iam_policy_flattened_error_async():
| 64 | 64 | 92 | 18 | 46 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_set_iam_policy_flattened_error_async | test_set_iam_policy_flattened_error_async | 4,512 | 4,524 | 4,512 | 4,513 | 8810e0e8759e36771e8195f14ce5df1d42bd3374 | bigcode/the-stack | train |
0e4e4aa31280a332f77c690c | train | function | @requires_google_auth_gte_1_25_0
def test_iam_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.iam.admin_v1.services.iam.transports.IAMTransport._pre... | @requires_google_auth_gte_1_25_0
def test_iam_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
| with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.iam.admin_v1.services.iam.transports.IAMTransport._prep_wrapped_messages') as Transport:
Transport.return_value = None
load_creds.return_value = (ga_credentials.AnonymousCredentials(), ... | with pytest.raises(NotImplementedError):
getattr(transport, method)(request=object())
with pytest.raises(NotImplementedError):
transport.close()
@requires_google_auth_gte_1_25_0
def test_iam_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
| 64 | 64 | 176 | 34 | 30 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_base_transport_with_credentials_file | test_iam_base_transport_with_credentials_file | 6,844 | 6,860 | 6,844 | 6,846 | f9219cc88c84ac1791650ded5567759b440a2da4 | bigcode/the-stack | train |
e26e0f90b4340d209a9fe11a | train | function | def test_create_service_account_flattened_error():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.create_service_account(
... | def test_create_service_account_flattened_error():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.create_service_account(
iam.CreateServiceAccountRequest(),
... | _, args, _ = call.mock_calls[0]
assert args[0].name == 'name_value'
assert args[0].account_id == 'account_id_value'
assert args[0].service_account == iam.ServiceAccount(name='name_value')
def test_create_service_account_flattened_error():
| 64 | 64 | 98 | 10 | 54 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_create_service_account_flattened_error | test_create_service_account_flattened_error | 1,288 | 1,301 | 1,288 | 1,288 | 56a6b15777a5902a2bcc7fd154445d708d6ec36f | bigcode/the-stack | train |
acab6b1b88c0e1e67d539a86 | train | function | def test_query_grantable_roles(transport: str = 'grpc', request_type=iam.QueryGrantableRolesRequest):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking... | def test_query_grantable_roles(transport: str = 'grpc', request_type=iam.QueryGrantableRolesRequest):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.test_iam_permissions(
iam_policy_pb2.TestIamPermissionsRequest(),
resource='resource_value',
permissions=['permissions_value'],
)
def test_query_granta... | 79 | 79 | 264 | 25 | 54 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_grantable_roles | test_query_grantable_roles | 4,781 | 4,808 | 4,781 | 4,781 | 06af25ed80d22341a3cdc5fa96436caff9319fd5 | bigcode/the-stack | train |
2e39f960897827a413a61156 | train | function | def test_sign_jwt_flattened():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.sign_jwt),
'__call__') as call:
# Designate an... | def test_sign_jwt_flattened():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.sign_jwt),
'__call__') as call:
# Designate an appropriate return value for t... | assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
def test_sign_jwt_flattened():
| 64 | 64 | 198 | 9 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_jwt_flattened | test_sign_jwt_flattened | 3,937 | 3,960 | 3,937 | 3,937 | 59cb1d90ca1be58f1f4ae12f00038889f2fc1f55 | bigcode/the-stack | train |
49872d4bba75cc0306adaf00 | train | function | @pytest.mark.asyncio
async def test_lint_policy_async_from_dict():
await test_lint_policy_async(request_type=dict)
| @pytest.mark.asyncio
async def test_lint_policy_async_from_dict():
| await test_lint_policy_async(request_type=dict)
| _, args, _ = call.mock_calls[0]
assert args[0] == iam.LintPolicyRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, iam.LintPolicyResponse)
@pytest.mark.asyncio
async def test_lint_policy_async_from_dict():
| 64 | 64 | 26 | 15 | 49 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_lint_policy_async_from_dict | test_lint_policy_async_from_dict | 6,706 | 6,708 | 6,706 | 6,707 | 410508fed2f958113e1e09ca7f8db59e07556acf | bigcode/the-stack | train |
a540a3366b9c22a5599e50c6 | train | function | def test_get_role_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call wi... | def test_get_role_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_role),
'__call__') as call:
client.get_role()
... | _blob'
assert response.deleted is True
def test_get_role_from_dict():
test_get_role(request_type=dict)
def test_get_role_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 134 | 40 | 24 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_role_empty_call | test_get_role_empty_call | 5,445 | 5,460 | 5,445 | 5,447 | 964b21d0fe07c1cec8bdc404ac540b6eb14579b3 | bigcode/the-stack | train |
1ab4adc02c98ad32e1f5952c | train | function | def test_get_service_account_from_dict():
test_get_service_account(request_type=dict)
| def test_get_service_account_from_dict():
| test_get_service_account(request_type=dict)
| email_value'
assert response.display_name == 'display_name_value'
assert response.etag == b'etag_blob'
assert response.description == 'description_value'
assert response.oauth2_client_id == 'oauth2_client_id_value'
assert response.disabled is True
def test_get_service_account_from_dict():
| 64 | 64 | 17 | 8 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_from_dict | test_get_service_account_from_dict | 860 | 861 | 860 | 860 | 50ba71f511bfe675dd818dbadcbf9a849558a6da | bigcode/the-stack | train |
8550b621f20084e98dd37d7b | train | function | @pytest.mark.asyncio
async def test_sign_blob_flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await cli... | @pytest.mark.asyncio
async def test_sign_blob_flattened_error_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.sign_blob(
iam.SignBlobRequest(),
name='nam... | assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].name == 'name_value'
assert args[0].bytes_to_sign == b'bytes_to_sign_blob'
@pytest.mark.asyncio
async def test_sign_blob_flattened_error_async():
| 64 | 64 | 95 | 16 | 48 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_blob_flattened_error_async | test_sign_blob_flattened_error_async | 3,766 | 3,779 | 3,766 | 3,767 | 792f9c9b39e19003fdcffe6636ad93aa208ac793 | bigcode/the-stack | train |
e88c7073dfea1ec8c62ea104 | train | function | @requires_google_auth_lt_1_25_0
def test_iam_base_transport_with_credentials_file_old_google_auth():
# Instantiate the base transport with a credentials file
with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.iam.admin_v1.services.iam.transports.IA... | @requires_google_auth_lt_1_25_0
def test_iam_base_transport_with_credentials_file_old_google_auth():
# Instantiate the base transport with a credentials file
| with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.iam.admin_v1.services.iam.transports.IAMTransport._prep_wrapped_messages') as Transport:
Transport.return_value = None
load_creds.return_value = (ga_credentials.AnonymousCredentials(), ... | default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
),
quota_project_id="octopus",
)
@requires_google_auth_lt_1_25_0
def test_iam_base_transport_with_credentials_file_old_google_auth():
# Instantiate the base transport with a credentials file
| 64 | 64 | 172 | 36 | 28 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_base_transport_with_credentials_file_old_google_auth | test_iam_base_transport_with_credentials_file_old_google_auth | 6,863 | 6,877 | 6,863 | 6,865 | 17122a976db42b0d9e230f993f08f7de963c22be | bigcode/the-stack | train |
b5f500f588fb1090c8cea9b4 | train | function | def test_list_roles_pager():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_roles),
'__call__') as call:
# Set the respon... | def test_list_roles_pager():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_roles),
'__call__') as call:
# Set the response to a series of pages.
... | Request()
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListRolesAsyncPager)
assert response.next_page_token == 'next_page_token_value'
@pytest.mark.asyncio
async def test_list_roles_async_from_dict():
await test_list_roles_async(request_type=dict)
def t... | 71 | 71 | 237 | 7 | 64 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_roles_pager | test_list_roles_pager | 5,218 | 5,264 | 5,218 | 5,218 | d54a207b2dd3aee268ffd604e21cbc08c831d95b | bigcode/the-stack | train |
c475af2a70f1a82bc005e341 | train | function | @pytest.mark.asyncio
async def test_get_iam_policy_async_from_dict():
await test_get_iam_policy_async(request_type=dict)
| @pytest.mark.asyncio
async def test_get_iam_policy_async_from_dict():
| await test_get_iam_policy_async(request_type=dict)
| 2.GetIamPolicyRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, policy_pb2.Policy)
assert response.version == 774
assert response.etag == b'etag_blob'
@pytest.mark.asyncio
async def test_get_iam_policy_async_from_dict():
| 64 | 64 | 28 | 16 | 48 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_iam_policy_async_from_dict | test_get_iam_policy_async_from_dict | 4,110 | 4,112 | 4,110 | 4,111 | 2f6c1d26c5ca3a84cf82ce8a905a5e7e8bbdb575 | bigcode/the-stack | train |
57b00e78e3f7f75471d8b9f5 | train | function | @pytest.mark.asyncio
async def test_list_service_accounts_async(transport: str = 'grpc_asyncio', request_type=iam.ListServiceAccountsRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the ... | @pytest.mark.asyncio
async def test_list_service_accounts_async(transport: str = 'grpc_asyncio', request_type=iam.ListServiceAccountsRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | (client.transport.list_service_accounts),
'__call__') as call:
client.list_service_accounts()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == iam.ListServiceAccountsRequest()
@pytest.mark.asyncio
async def test_list_service_accounts_async(transport: str... | 81 | 81 | 271 | 31 | 50 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_service_accounts_async | test_list_service_accounts_async | 449 | 477 | 449 | 450 | cfc79afa31ca59f542bed92ff99429ef5924e12a | bigcode/the-stack | train |
967d2b65e078843e91139d90 | train | function | def test_set_iam_policy_from_dict_foreign():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.set_iam_policy),
'__call__') as call:
... | def test_set_iam_policy_from_dict_foreign():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.set_iam_policy),
'__call__') as call:
# Designate an appropriate return value ... | [0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'resource=resource/value',
) in kw['metadata']
def test_set_iam_policy_from_dict_foreign():
| 64 | 64 | 129 | 11 | 53 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_set_iam_policy_from_dict_foreign | test_set_iam_policy_from_dict_foreign | 4,429 | 4,444 | 4,429 | 4,429 | 9c9d8a3879dfdff530d32eb07a6c361dc171f5db | bigcode/the-stack | train |
1f3e21aa23cd67ee98b5dc0a | train | function | def test_parse_common_folder_path():
expected = {
"folder": "clam",
}
path = IAMClient.common_folder_path(**expected)
# Check that the path construction is reversible.
actual = IAMClient.parse_common_folder_path(path)
assert expected == actual
| def test_parse_common_folder_path():
| expected = {
"folder": "clam",
}
path = IAMClient.common_folder_path(**expected)
# Check that the path construction is reversible.
actual = IAMClient.parse_common_folder_path(path)
assert expected == actual
| .parse_common_billing_account_path(path)
assert expected == actual
def test_common_folder_path():
folder = "squid"
expected = "folders/{folder}".format(folder=folder, )
actual = IAMClient.common_folder_path(folder)
assert expected == actual
def test_parse_common_folder_path():
| 64 | 64 | 58 | 7 | 56 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_parse_common_folder_path | test_parse_common_folder_path | 7,227 | 7,235 | 7,227 | 7,227 | 587eacb03897813b481bce61db27d6d1ec50af22 | bigcode/the-stack | train |
46f0d0998b90ff0c17de3b45 | train | function | @pytest.mark.asyncio
async def test_sign_jwt_flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await clie... | @pytest.mark.asyncio
async def test_sign_jwt_flattened_error_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.sign_jwt(
iam.SignJwtRequest(),
name='name_... | request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].name == 'name_value'
assert args[0].payload == 'payload_value'
@pytest.mark.asyncio
async def test_sign_jwt_flattened_error_async():
| 64 | 64 | 92 | 17 | 47 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_jwt_flattened_error_async | test_sign_jwt_flattened_error_async | 4,007 | 4,020 | 4,007 | 4,008 | d63ed1ea70cc8c3dca3aff14e9a527d0ff04c1ed | bigcode/the-stack | train |
52d3ec76cf314eba2f61f23e | train | function | def test_transport_get_channel():
# A client may be instantiated with a custom transport instance.
transport = transports.IAMGrpcTransport(
credentials=ga_credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel
assert channel
transport = transports.IAMGrpcAsyncIOTransport... | def test_transport_get_channel():
# A client may be instantiated with a custom transport instance.
| transport = transports.IAMGrpcTransport(
credentials=ga_credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel
assert channel
transport = transports.IAMGrpcAsyncIOTransport(
credentials=ga_credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel... | be instantiated with a custom transport instance.
transport = transports.IAMGrpcTransport(
credentials=ga_credentials.AnonymousCredentials(),
)
client = IAMClient(transport=transport)
assert client.transport is transport
def test_transport_get_channel():
# A client may be instantiated with ... | 64 | 64 | 83 | 19 | 44 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_transport_get_channel | test_transport_get_channel | 6,751 | 6,763 | 6,751 | 6,752 | bb4978b949cdb1eb7f6280306df07cbdb27bde47 | bigcode/the-stack | train |
3bb1b5128d5d44348a47e1ec | train | function | def test_disable_service_account_field_headers():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.DisableServiceAccountRequest()
reque... | def test_disable_service_account_field_headers():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.DisableServiceAccountRequest()
request.name = 'name/value'
# Mock the actual call... | assert args[0] == iam.DisableServiceAccountRequest()
# Establish that the response is the type that we expect.
assert response is None
@pytest.mark.asyncio
async def test_disable_service_account_async_from_dict():
await test_disable_service_account_async(request_type=dict)
def test_disable_servic... | 66 | 66 | 220 | 8 | 58 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_disable_service_account_field_headers | test_disable_service_account_field_headers | 2,317 | 2,345 | 2,317 | 2,317 | 25cf98fca564b6a8d16872398d7f6786d78031f8 | bigcode/the-stack | train |
5c04643b707bb9b436a2071a | train | function | def test_set_iam_policy(transport: str = 'grpc', request_type=iam_policy_pb2.SetIamPolicyRequest):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking ou... | def test_set_iam_policy(transport: str = 'grpc', request_type=iam_policy_pb2.SetIamPolicyRequest):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.get_iam_policy(
iam_policy_pb2.GetIamPolicyRequest(),
resource='resource_value',
)
def test_set_iam_policy(transport: str = 'grpc', req... | 80 | 80 | 269 | 26 | 54 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_set_iam_policy | test_set_iam_policy | 4,275 | 4,304 | 4,275 | 4,275 | 42f5ebb6d4464afc9271c17ead586e0aadcce73f | bigcode/the-stack | train |
a9459ae13fb4dd89a06dcd42 | train | function | @pytest.mark.asyncio
async def test_sign_jwt_field_headers_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.SignJwtRequest()
... | @pytest.mark.asyncio
async def test_sign_jwt_field_headers_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam.SignJwtRequest()
request.name = 'name/value'
# Mock the actual call within t... | assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
@pytest.mark.asyncio
async def test_sign_jwt_field_headers_async():
| 70 | 70 | 236 | 15 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_sign_jwt_field_headers_async | test_sign_jwt_field_headers_async | 3,905 | 3,934 | 3,905 | 3,906 | 8c24371af61c7ce62fcf0c705e96bfef203b5185 | bigcode/the-stack | train |
a7c59c14b9ff41c83ac36ae5 | train | function | @pytest.mark.asyncio
async def test_list_service_account_keys_async_from_dict():
await test_list_service_account_keys_async(request_type=dict)
| @pytest.mark.asyncio
async def test_list_service_account_keys_async_from_dict():
| await test_list_service_account_keys_async(request_type=dict)
| , _ = call.mock_calls[0]
assert args[0] == iam.ListServiceAccountKeysRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, iam.ListServiceAccountKeysResponse)
@pytest.mark.asyncio
async def test_list_service_account_keys_async_from_dict():
| 64 | 64 | 28 | 16 | 48 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_service_account_keys_async_from_dict | test_list_service_account_keys_async_from_dict | 2,459 | 2,461 | 2,459 | 2,460 | dcf783158105e969b080fc0d63af4ff0973c7152 | bigcode/the-stack | train |
e138f6a44654011fdf6c99a2 | train | function | def test_delete_service_account_from_dict():
test_delete_service_account(request_type=dict)
| def test_delete_service_account_from_dict():
| test_delete_service_account(request_type=dict)
| .
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0] == iam.DeleteServiceAccountRequest()
# Establish that the response is the type that we expect.
assert response is None
def test_delete_service_account_from_dict():
| 64 | 64 | 17 | 8 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_delete_service_account_from_dict | test_delete_service_account_from_dict | 1,745 | 1,746 | 1,745 | 1,745 | 5e0059b20d65651f901790eac3c7160b90dcccaa | bigcode/the-stack | train |
a739a13e0637d3ecd32463da | train | function | def test_enable_service_account(transport: str = 'grpc', request_type=iam.EnableServiceAccountRequest):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocki... | def test_enable_service_account(transport: str = 'grpc', request_type=iam.EnableServiceAccountRequest):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
def test_enable_service_account(transport: str = 'grpc', request_type=iam.EnableServiceAccountRequest):
| 65 | 65 | 219 | 22 | 43 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_enable_service_account | test_enable_service_account | 2,090 | 2,114 | 2,090 | 2,090 | 95b9a13f4822b5069a14cfdb887791e98761e7ef | bigcode/the-stack | train |
dedc5893b538675318bd46b2 | train | function | def test_create_service_account_from_dict():
test_create_service_account(request_type=dict)
| def test_create_service_account_from_dict():
| test_create_service_account(request_type=dict)
| email_value'
assert response.display_name == 'display_name_value'
assert response.etag == b'etag_blob'
assert response.description == 'description_value'
assert response.oauth2_client_id == 'oauth2_client_id_value'
assert response.disabled is True
def test_create_service_account_from_dict():
| 64 | 64 | 17 | 8 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_create_service_account_from_dict | test_create_service_account_from_dict | 1,123 | 1,124 | 1,123 | 1,123 | 9239daaad641647028889e3933a1543ba56b9bbb | bigcode/the-stack | train |
11156cc2af63983707fc67fb | train | function | @pytest.mark.asyncio
async def test_create_service_account_flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
... | @pytest.mark.asyncio
async def test_create_service_account_flattened_error_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.create_service_account(
iam.CreateServiceAccountRequest... | _calls[0]
assert args[0].name == 'name_value'
assert args[0].account_id == 'account_id_value'
assert args[0].service_account == iam.ServiceAccount(name='name_value')
@pytest.mark.asyncio
async def test_create_service_account_flattened_error_async():
| 64 | 64 | 107 | 17 | 47 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_create_service_account_flattened_error_async | test_create_service_account_flattened_error_async | 1,335 | 1,349 | 1,335 | 1,336 | 33d7db5ab28d8b9d2581fbc694f6e699958aa492 | bigcode/the-stack | train |
de7fd66d10a83a1ba436e47b | train | function | @pytest.mark.asyncio
async def test_query_grantable_roles_async(transport: str = 'grpc_asyncio', request_type=iam.QueryGrantableRolesRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the ... | @pytest.mark.asyncio
async def test_query_grantable_roles_async(transport: str = 'grpc_asyncio', request_type=iam.QueryGrantableRolesRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | able_roles),
'__call__') as call:
client.query_grantable_roles()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == iam.QueryGrantableRolesRequest()
@pytest.mark.asyncio
async def test_query_grantable_roles_async(transport: str = 'grpc_asyncio', request_ty... | 84 | 84 | 281 | 34 | 50 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_grantable_roles_async | test_query_grantable_roles_async | 4,833 | 4,861 | 4,833 | 4,834 | eb30f97c5b8d72770450f575ae1ad0c46e31070a | bigcode/the-stack | train |
28617e41c1c80c7492c82761 | train | function | def test_list_service_accounts_pager():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_service_accounts),
'__call__') as call:
... | def test_list_service_accounts_pager():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_service_accounts),
'__call__') as call:
# Set the response to a series of ... | _flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.list_service_accounts(
iam.Li... | 84 | 84 | 281 | 8 | 76 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_list_service_accounts_pager | test_list_service_accounts_pager | 628 | 679 | 628 | 628 | 0c7ddd088a5e3d0068f92f47bfffa22349bf7cbd | bigcode/the-stack | train |
00f4823071d248b876f52348 | train | function | def test_enable_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the ... | def test_enable_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport='grpc',
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.enable_service_account),
'__call__') as call:
clien... | assert response is None
def test_enable_service_account_from_dict():
test_enable_service_account(request_type=dict)
def test_enable_service_account_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
| 64 | 64 | 138 | 41 | 23 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_enable_service_account_empty_call | test_enable_service_account_empty_call | 2,121 | 2,136 | 2,121 | 2,123 | 64f7ac334eb5769ea20e1151d326056c46486742 | bigcode/the-stack | train |
4861c818d985a560b874ea91 | train | function | @pytest.mark.parametrize("client_class,transport_class,transport_name", [
(IAMClient, transports.IAMGrpcTransport, "grpc"),
(IAMAsyncClient, transports.IAMGrpcAsyncIOTransport, "grpc_asyncio"),
])
@mock.patch.object(IAMClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IAMClient))
@mock.patch.object(IAMAsyncCl... | @pytest.mark.parametrize("client_class,transport_class,transport_name", [
(IAMClient, transports.IAMGrpcTransport, "grpc"),
(IAMAsyncClient, transports.IAMGrpcAsyncIOTransport, "grpc_asyncio"),
])
@mock.patch.object(IAMClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IAMClient))
@mock.patch.object(IAMAsyncCl... | with mock.patch.object(IAMClient, 'get_transport_class') as gtc:
transport = transport_class(
credentials=ga_credentials.AnonymousCredentials()
)
client = client_class(transport=transport)
gtc.assert_not_called()
# Check that if channel is provided via str we will cr... | client_class.from_service_account_file("dummy/file/path.json")
assert client.transport._credentials == creds
assert isinstance(client, client_class)
client = client_class.from_service_account_json("dummy/file/path.json")
assert client.transport._credentials == creds
assert isin... | 256 | 256 | 862 | 119 | 136 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_client_client_options | test_iam_client_client_options | 152 | 247 | 152 | 159 | 22cbd71690ac1f231c73701d5beb6f815d938e2d | bigcode/the-stack | train |
deb813f8669e9a38137b77c2 | train | function | def test_update_service_account(transport: str = 'grpc', request_type=iam.ServiceAccount):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the ac... | def test_update_service_account(transport: str = 'grpc', request_type=iam.ServiceAccount):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | ed_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.create_service_account(
iam.CreateSer... | 114 | 114 | 381 | 20 | 94 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_update_service_account | test_update_service_account | 1,352 | 1,395 | 1,352 | 1,352 | 8255d7e278fce10d338d8af0281b6845d79ab22d | bigcode/the-stack | train |
086221329e59478a1d8b3f0a | train | function | def test_client_withDEFAULT_CLIENT_INFO():
client_info = gapic_v1.client_info.ClientInfo()
with mock.patch.object(transports.IAMTransport, '_prep_wrapped_messages') as prep:
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
client_info=client_info,
)... | def test_client_withDEFAULT_CLIENT_INFO():
| client_info = gapic_v1.client_info.ClientInfo()
with mock.patch.object(transports.IAMTransport, '_prep_wrapped_messages') as prep:
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
client_info=client_info,
)
prep.assert_called_once_with(clien... | "project": "winkle",
"location": "nautilus",
}
path = IAMClient.common_location_path(**expected)
# Check that the path construction is reversible.
actual = IAMClient.parse_common_location_path(path)
assert expected == actual
def test_client_withDEFAULT_CLIENT_INFO():
| 64 | 64 | 137 | 8 | 55 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_client_withDEFAULT_CLIENT_INFO | test_client_withDEFAULT_CLIENT_INFO | 7,291 | 7,307 | 7,291 | 7,291 | ec8e6f7871ec361e9f61ae5e72399cf8d4a26f12 | bigcode/the-stack | train |
fd147bf1626571cd46f7995b | train | function | @pytest.mark.asyncio
async def test_test_iam_permissions_async(transport: str = 'grpc_asyncio', request_type=iam_policy_pb2.TestIamPermissionsRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as fa... | @pytest.mark.asyncio
async def test_test_iam_permissions_async(transport: str = 'grpc_asyncio', request_type=iam_policy_pb2.TestIamPermissionsRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | '__call__') as call:
client.test_iam_permissions()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == iam_policy_pb2.TestIamPermissionsRequest()
@pytest.mark.asyncio
async def test_test_iam_permissions_async(transport: str = 'grpc_asyncio', request_type=iam_policy_pb... | 82 | 82 | 276 | 35 | 47 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_test_iam_permissions_async | test_test_iam_permissions_async | 4,579 | 4,607 | 4,579 | 4,580 | c27cbc4ea2b5fe24793ae96958786721ddc60c4c | bigcode/the-stack | train |
c167dd8f04a39667ad1e0e59 | train | function | @pytest.mark.asyncio
async def test_query_grantable_roles_flattened_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.query_grantable... | @pytest.mark.asyncio
async def test_query_grantable_roles_flattened_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.query_grantable_roles),
'__call__') as call:
# Designate an appropriate ... | both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.query_grantable_roles(
iam.QueryGrantableRolesRequest(),
full_resource_name='full_resource_name_value',
)
@pytest.mark.asyncio
async def test_query_grantable_roles_flattened_... | 67 | 67 | 224 | 18 | 49 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_grantable_roles_flattened_async | test_query_grantable_roles_flattened_async | 4,907 | 4,931 | 4,907 | 4,908 | 64e75a97a380e0a97e68ff5c26efd9b0e31e47c1 | bigcode/the-stack | train |
f49ed86018cc59c1683e36ce | train | function | def test_get_service_account_key_flattened():
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_service_account_key),
'__call__') a... | def test_get_service_account_key_flattened():
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.get_service_account_key),
'__call__') as call:
# Designate an appropriate ret... | 0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
def test_get_service_account_key_flattened():
| 67 | 67 | 224 | 10 | 57 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_get_service_account_key_flattened | test_get_service_account_key_flattened | 2,788 | 2,811 | 2,788 | 2,788 | 86c801d489e42caa865c71f7b441764792d6d37a | bigcode/the-stack | train |
314c6aa7d8fcfe5a0010cff5 | train | function | @pytest.mark.asyncio
async def test_test_iam_permissions_field_headers_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam_policy... | @pytest.mark.asyncio
async def test_test_iam_permissions_field_headers_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = iam_policy_pb2.TestIamPermissionsRequest()
request.resource = 'resource/value'
#... | 0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'resource=resource/value',
) in kw['metadata']
@pytest.mark.asyncio
async def test_test_iam_permissions_field_headers_async():
| 74 | 74 | 248 | 16 | 58 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_test_iam_permissions_field_headers_async | test_test_iam_permissions_field_headers_async | 4,646 | 4,675 | 4,646 | 4,647 | ff09caeec4377eddeab9f35438a7f81eb0573a70 | bigcode/the-stack | train |
2de0a59e7e7a657a0f4db034 | train | function | @pytest.mark.asyncio
async def test_query_grantable_roles_flattened_error_async():
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
... | @pytest.mark.asyncio
async def test_query_grantable_roles_flattened_error_async():
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.query_grantable_roles(
iam.QueryGrantableRolesRequest()... | with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].full_resource_name == 'full_resource_name_value'
@pytest.mark.asyncio
async def test_query_grantable_roles_flattened_error_async():
| 64 | 64 | 96 | 19 | 45 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_grantable_roles_flattened_error_async | test_query_grantable_roles_flattened_error_async | 4,934 | 4,946 | 4,934 | 4,935 | cc3ee2c772aa60d9a04b776b8b5d613a7993de7e | bigcode/the-stack | train |
426be31023a6a5124537f8b0 | train | function | def test_undelete_service_account_from_dict():
test_undelete_service_account(request_type=dict)
| def test_undelete_service_account_from_dict():
| test_undelete_service_account(request_type=dict)
|
_, args, _ = call.mock_calls[0]
assert args[0] == iam.UndeleteServiceAccountRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, iam.UndeleteServiceAccountResponse)
def test_undelete_service_account_from_dict():
| 64 | 64 | 21 | 10 | 54 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_undelete_service_account_from_dict | test_undelete_service_account_from_dict | 1,971 | 1,972 | 1,971 | 1,971 | f195ccc42492a08946e5eca237401b332ed54258 | bigcode/the-stack | train |
c1ff277847f6dfb5b2694563 | train | function | def test_delete_service_account_key(transport: str = 'grpc', request_type=iam.DeleteServiceAccountKeyRequest):
client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we ar... | def test_delete_service_account_key(transport: str = 'grpc', request_type=iam.DeleteServiceAccountKeyRequest):
| client = IAMClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the actua... | that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
'x-goog-request-params',
'name=name/value',
) in kw['metadata']
def test_delete_service_account_key(transport: str = 'grpc', request_type=iam.DeleteServiceAccountKeyRequest):
| 67 | 67 | 224 | 24 | 43 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_delete_service_account_key | test_delete_service_account_key | 3,316 | 3,340 | 3,316 | 3,316 | d0292d71dafa650d2dba1190c148694469e21455 | bigcode/the-stack | train |
ee0224b5be6113b1c4e102c4 | train | function | @pytest.mark.asyncio
async def test_enable_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.EnableServiceAccountRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as th... | @pytest.mark.asyncio
async def test_enable_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.EnableServiceAccountRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | as call:
client.enable_service_account()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == iam.EnableServiceAccountRequest()
@pytest.mark.asyncio
async def test_enable_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.EnableServiceAccountReques... | 70 | 70 | 234 | 31 | 39 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_enable_service_account_async | test_enable_service_account_async | 2,139 | 2,164 | 2,139 | 2,140 | 3911e65d14c00d75714cb5e82c9ed6e0316e65eb | bigcode/the-stack | train |
1b9d10971499d9307df08415 | train | function | @pytest.mark.parametrize("client_class,transport_class,transport_name", [
(IAMClient, transports.IAMGrpcTransport, "grpc"),
(IAMAsyncClient, transports.IAMGrpcAsyncIOTransport, "grpc_asyncio"),
])
def test_iam_client_client_options_scopes(client_class, transport_class, transport_name):
# Check the case scop... | @pytest.mark.parametrize("client_class,transport_class,transport_name", [
(IAMClient, transports.IAMGrpcTransport, "grpc"),
(IAMAsyncClient, transports.IAMGrpcAsyncIOTransport, "grpc_asyncio"),
])
def test_iam_client_client_options_scopes(client_class, transport_class, transport_name):
# Check the case scop... | options = client_options.ClientOptions(
scopes=["1", "2"],
)
with mock.patch.object(transport_class, '__init__') as patched:
patched.return_value = None
client = client_class(client_options=options)
patched.assert_called_once_with(
credentials=None,
cr... | @pytest.mark.parametrize("client_class,transport_class,transport_name", [
(IAMClient, transports.IAMGrpcTransport, "grpc"),
(IAMAsyncClient, transports.IAMGrpcAsyncIOTransport, "grpc_asyncio"),
])
def test_iam_client_client_options_scopes(client_class, transport_class, transport_name):
# Check the case scop... | 75 | 64 | 193 | 75 | 0 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_iam_client_client_options_scopes | test_iam_client_client_options_scopes | 332 | 353 | 332 | 337 | 555e3cf63afbc64dcf59206b433a86b215b20daa | bigcode/the-stack | train |
542b6d87cff87371645e68c0 | train | function | @pytest.mark.asyncio
async def test_delete_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.DeleteServiceAccountRequest):
client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as th... | @pytest.mark.asyncio
async def test_delete_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.DeleteServiceAccountRequest):
| client = IAMAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# Mock the ... | as call:
client.delete_service_account()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == iam.DeleteServiceAccountRequest()
@pytest.mark.asyncio
async def test_delete_service_account_async(transport: str = 'grpc_asyncio', request_type=iam.DeleteServiceAccountReques... | 70 | 70 | 234 | 31 | 39 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_delete_service_account_async | test_delete_service_account_async | 1,767 | 1,792 | 1,767 | 1,768 | 141f53f50f25f5818fdc66263a87d72bfca53f0e | bigcode/the-stack | train |
37d29a5273a749bec5b56ea7 | train | function | def test_query_auditable_services_from_dict():
test_query_auditable_services(request_type=dict)
| def test_query_auditable_services_from_dict():
| test_query_auditable_services(request_type=dict)
| 1
_, args, _ = call.mock_calls[0]
assert args[0] == iam.QueryAuditableServicesRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, iam.QueryAuditableServicesResponse)
def test_query_auditable_services_from_dict():
| 64 | 64 | 21 | 10 | 54 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_query_auditable_services_from_dict | test_query_auditable_services_from_dict | 6,571 | 6,572 | 6,571 | 6,571 | 1d8a151b0cf655544c96a8381e37eca67442b5d7 | bigcode/the-stack | train |
869dfc34b2a747e29ee887c0 | train | function | @pytest.mark.asyncio
async def test_delete_service_account_key_async_from_dict():
await test_delete_service_account_key_async(request_type=dict)
| @pytest.mark.asyncio
async def test_delete_service_account_key_async_from_dict():
| await test_delete_service_account_key_async(request_type=dict)
| .mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == iam.DeleteServiceAccountKeyRequest()
# Establish that the response is the type that we expect.
assert response is None
@pytest.mark.asyncio
async def test_delete_service_account_key_async_from_dict():
| 64 | 64 | 28 | 16 | 47 | googleapis/googleapis-gen | google/iam/admin/v1/iam-admin-v1-py/tests/unit/gapic/admin_v1/test_iam.py | Python | test_delete_service_account_key_async_from_dict | test_delete_service_account_key_async_from_dict | 3,393 | 3,395 | 3,393 | 3,394 | 5129bbbc7eaabbe664ba736e01bddafc236eabc0 | bigcode/the-stack | train |
4fa9af51e88a0ce270f596e2 | train | class | class Migration(migrations.Migration):
dependencies = [
('food', '0004_auto_20150227_0848'),
]
operations = [
migrations.AlterModelOptions(
name='foodingredient',
options={},
),
migrations.RemoveField(
model_name='foodingredient',
... | class Migration(migrations.Migration):
| dependencies = [
('food', '0004_auto_20150227_0848'),
]
operations = [
migrations.AlterModelOptions(
name='foodingredient',
options={},
),
migrations.RemoveField(
model_name='foodingredient',
name='created',
),
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
| 31 | 64 | 97 | 7 | 23 | delphcf/sis | sis/food/migrations/0005_auto_20150227_0849.py | Python | Migration | Migration | 7 | 26 | 7 | 8 | 23bb2bc191f9e05c10c60143d332ed4f99c53b8e | bigcode/the-stack | train |
2f55f33ab09915c9e27da5e1 | train | function | async def async_setup(hass, config):
"""Mock a successful setup."""
return True
| async def async_setup(hass, config):
| """Mock a successful setup."""
return True
| """Provide a mock standalone component."""
DOMAIN = 'test_standalone'
async def async_setup(hass, config):
| 24 | 64 | 20 | 9 | 15 | dauden1184/home-assistant | tests/testing_config/custom_components/test_standalone.py | Python | async_setup | async_setup | 5 | 7 | 5 | 5 | e1db3f2b3e8326ead47e80b0bc6a8ab92eaf3dbc | bigcode/the-stack | train |
6ba4e6adb77bfbfa061aabc6 | train | class | @dataclass
class ResponseDC(ApiDC):
""" Ответ от сервиса.
:status: Статус ответа. Если в этом поле `false`, то поле `result`
содержит описание ошибки.
:result: Результат ответа.
:id: Идентификатор исходного запроса к сервису. Если это поле
было установл... | @dataclass
class ResponseDC(ApiDC):
| """ Ответ от сервиса.
:status: Статус ответа. Если в этом поле `false`, то поле `result`
содержит описание ошибки.
:result: Результат ответа.
:id: Идентификатор исходного запроса к сервису. Если это поле
было установлено в запросе, то в ответе будет иде... | Результат чтения.
"""
name: str
length: int
rows: list
@dataclass
class CreateResult(ApiDC):
""" Результат чтения.
"""
name: str
message: str = "ok"
@dataclass
class ResponseDC(ApiDC):
| 64 | 64 | 117 | 9 | 55 | EvgeniyBurdin/pyms | data_classes/responses.py | Python | ResponseDC | ResponseDC | 39 | 52 | 39 | 40 | a351b01ad917d18d0f3726db35e9f3e17b35d15a | bigcode/the-stack | train |
968d4d7fc70e16d7088ebc5f | train | class | @dataclass
class ReadResult(ApiDC):
""" Результат чтения.
"""
name: str
length: int
rows: list
| @dataclass
class ReadResult(ApiDC):
| """ Результат чтения.
"""
name: str
length: int
rows: list
| Тип ошибки.
:message: Сообщение об ошибке.
:extra: Словарь с дополнительными данными об ошибке.
"""
error_type: str
message: str
extra: Optional[dict] = None
@dataclass
class ReadResult(ApiDC):
| 64 | 64 | 34 | 9 | 54 | EvgeniyBurdin/pyms | data_classes/responses.py | Python | ReadResult | ReadResult | 22 | 28 | 22 | 23 | e0577997c4ee4cae0fcaec0e86b96b71541e4165 | bigcode/the-stack | train |
f3c3c9c7baf23d3b7f8724e7 | train | class | @dataclass
class CreateResult(ApiDC):
""" Результат чтения.
"""
name: str
message: str = "ok"
| @dataclass
class CreateResult(ApiDC):
| """ Результат чтения.
"""
name: str
message: str = "ok"
| error_type: str
message: str
extra: Optional[dict] = None
@dataclass
class ReadResult(ApiDC):
""" Результат чтения.
"""
name: str
length: int
rows: list
@dataclass
class CreateResult(ApiDC):
| 64 | 64 | 32 | 9 | 54 | EvgeniyBurdin/pyms | data_classes/responses.py | Python | CreateResult | CreateResult | 31 | 36 | 31 | 32 | 84c092b066576d1c19f63ab79f072c121907df55 | bigcode/the-stack | train |
5a009dc7f1fb4c5ab8fcccb1 | train | class | @dataclass
class ErrorResult(ApiDC):
""" Ошибка API.
:error_type: Тип ошибки.
:message: Сообщение об ошибке.
:extra: Словарь с дополнительными данными об ошибке.
"""
error_type: str
message: str
extra: Optional[dict] = None
| @dataclass
class ErrorResult(ApiDC):
| """ Ошибка API.
:error_type: Тип ошибки.
:message: Сообщение об ошибке.
:extra: Словарь с дополнительными данными об ошибке.
"""
error_type: str
message: str
extra: Optional[dict] = None
| """ Модуль датаклассов ответов.
"""
from dataclasses import dataclass
from typing import Optional, Union
from data_classes.base import ApiDC
@dataclass
class ErrorResult(ApiDC):
| 43 | 64 | 75 | 9 | 33 | EvgeniyBurdin/pyms | data_classes/responses.py | Python | ErrorResult | ErrorResult | 9 | 19 | 9 | 10 | aa0d46c0ba1f955fca72504bebbf7c782f811ac3 | bigcode/the-stack | train |
5ebd91d2da26a540aedb9b53 | train | function | def list_tags(identity_client, tag_namespace_id, tag_name, module):
try:
if tag_name is not None:
tag = oci_utils.call_with_backoff(
identity_client.get_tag,
tag_namespace_id=tag_namespace_id,
tag_name=tag_name,
).data
retur... | def list_tags(identity_client, tag_namespace_id, tag_name, module):
| try:
if tag_name is not None:
tag = oci_utils.call_with_backoff(
identity_client.get_tag,
tag_namespace_id=tag_namespace_id,
tag_name=tag_name,
).data
return to_dict([tag])
return to_dict(
oci_utils.call... | _client import IdentityClient
from oci.util import to_dict
from oci.exceptions import ServiceError
HAS_OCI_PY_SDK = True
except ImportError:
HAS_OCI_PY_SDK = False
def list_tags(identity_client, tag_namespace_id, tag_name, module):
| 64 | 64 | 120 | 15 | 48 | slmjy/oci-ansible-modules | library/oci_tag_facts.py | Python | list_tags | list_tags | 116 | 132 | 116 | 116 | 3e8bba7932d406a05cd3a1663b3a7dc5a56f1166 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.