Coverage for /pythoncovmergedfiles/medio/medio/src/fuzz_credentials.py: 59%
37 statements
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-16 06:17 +0000
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-16 06:17 +0000
1###### Coverage stub
2import atexit
3import coverage
4cov = coverage.coverage(data_file='.coverage', cover_pylib=True)
5cov.start()
6# Register an exist handler that will print coverage
7def exit_handler():
8 cov.stop()
9 cov.save()
10atexit.register(exit_handler)
11####### End of coverage stub
12#!/usr/bin/python3
13# Copyright 2022 Google LLC
14#
15# Licensed under the Apache License, Version 2.0 (the "License");
16# you may not use this file except in compliance with the License.
17# You may obtain a copy of the License at
18#
19# http://www.apache.org/licenses/LICENSE-2.0
20#
21# Unless required by applicable law or agreed to in writing, software
22# distributed under the License is distributed on an "AS IS" BASIS,
23# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24# See the License for the specific language governing permissions and
25# limitations under the License.
27import sys
28import atheris
29with atheris.instrument_imports():
30 import google.cloud.iam_credentials_v1.services.iam_credentials as iam
32def TestOneInput(data):
33 fdp = atheris.FuzzedDataProvider(data)
35 iam.IAMCredentialsClient.service_account_path(
36 fdp.ConsumeString(100),
37 fdp.ConsumeString(100)
38 )
39 iam.IAMCredentialsClient.parse_service_account_path(fdp.ConsumeString(100))
40 iam.IAMCredentialsClient.parse_service_account_path(
41 "projects/%s/serviceAccounts/%s"%(
42 fdp.ConsumeString(100),
43 fdp.ConsumeString(100)
44 )
45 )
47 iam.IAMCredentialsClient.common_billing_account_path(fdp.ConsumeString(100))
48 iam.IAMCredentialsClient.parse_common_billing_account_path(fdp.ConsumeString(100))
49 iam.IAMCredentialsClient.parse_common_billing_account_path(
50 "billingAccounts/%s/"%fdp.ConsumeString(100)
51 )
53 iam.IAMCredentialsClient.common_folder_path(fdp.ConsumeString(100))
54 iam.IAMCredentialsClient.parse_common_folder_path(fdp.ConsumeString(100))
55 iam.IAMCredentialsClient.parse_common_folder_path(
56 "folders/%s/"%fdp.ConsumeString(100)
57 )
59 iam.IAMCredentialsClient.common_organization_path(fdp.ConsumeString(100))
60 iam.IAMCredentialsClient.parse_common_organization_path(fdp.ConsumeString(100))
61 iam.IAMCredentialsClient.parse_common_organization_path(
62 "organizations/%s/"%fdp.ConsumeString(100)
63 )
65 iam.IAMCredentialsClient.common_project_path(fdp.ConsumeString(100))
66 iam.IAMCredentialsClient.parse_common_project_path(fdp.ConsumeString(100))
67 iam.IAMCredentialsClient.parse_common_project_path(
68 "projects/%s/"%fdp.ConsumeString(100)
69 )
71 iam.IAMCredentialsClient.common_location_path(
72 fdp.ConsumeString(100),
73 fdp.ConsumeString(100)
74 )
75 iam.IAMCredentialsClient.parse_common_location_path(fdp.ConsumeString(100))
76 iam.IAMCredentialsClient.parse_common_location_path(
77 "projects/%s/locations/%s"%(
78 fdp.ConsumeString(100),
79 fdp.ConsumeString(100)
80 )
81 )
83def main():
84 atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
85 atheris.Fuzz()
87if __name__ == "__main__":
88 main()