Commit 8b3d0f5
authored
chore(cloudrun): refactor to sample 'cloudrun_service_to_service_receive' and its test (#13292)
* fix(cloudrun): update dependencies to latest versions
* fix(cloudrun): delete noxfile_config.py as it was outdated for Python 3.8 and is not required anymore
* fix(cloudrun): refactor sample and test to comply with current Style Guide.
- Apply fixes for Style Guide
- Add type hints
- Rename variables to be consistent with their values
- Add HTTP error codes constants to avoid managing 'magic numbers'
- Rewrite comments for accuracy
* fix(cloudrun): migrate region tag step 1 - add region with prefix auth as this sample is not specific to Cloud Run
* fix(cloudrun): add comment suggested by gemini-code-assist
* fix(cloudrun): add missing new line
* fix(cloudrun): add test for anonymous request, and rename key function and region tag
* fix(cloudrun): add sample to detect an invalid token
* fix(cloudrun): add missing new line
* fix(cloudrun): apply feedback from PR Review by glasnt
PR Review #13292 (review)
- Replace HTTP status codes with IntEnum from http.HTTPStatus
- Replace hard coded token with a fixture for a fake token
- Remove duplicated code for the client, and moving it to a test fixture
Also
- Add HTTP codes to the app.py `/` endpoint
- Replace 'UTF-8' with 'utf-8' to follow the official documentation
* fix(cloudrun): apply feedback from PR Review
#13292 (comment)1 parent e36edb4 commit 8b3d0f5
File tree
6 files changed
+129
-99
lines changed- run/service-auth
6 files changed
+129
-99
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
29 | 36 | | |
30 | | - | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | | - | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | | - | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | | - | |
48 | | - | |
49 | 57 | | |
| 58 | + | |
50 | 59 | | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
27 | 43 | | |
28 | 44 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
35 | 49 | | |
36 | | - | |
| 50 | + | |
37 | 51 | | |
38 | 52 | | |
39 | 53 | | |
40 | 54 | | |
41 | 55 | | |
42 | | - | |
| 56 | + | |
43 | 57 | | |
44 | | - | |
| 58 | + | |
45 | 59 | | |
46 | 60 | | |
47 | 61 | | |
48 | 62 | | |
49 | 63 | | |
50 | 64 | | |
| 65 | + | |
51 | 66 | | |
52 | 67 | | |
53 | 68 | | |
54 | | - | |
55 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
56 | 92 | | |
57 | 93 | | |
58 | 94 | | |
| |||
61 | 97 | | |
62 | 98 | | |
63 | 99 | | |
64 | | - | |
| 100 | + | |
65 | 101 | | |
66 | 102 | | |
67 | 103 | | |
| |||
72 | 108 | | |
73 | 109 | | |
74 | 110 | | |
75 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
76 | 117 | | |
77 | 118 | | |
78 | 119 | | |
| |||
82 | 123 | | |
83 | 124 | | |
84 | 125 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 126 | + | |
103 | 127 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | 128 | | |
108 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
109 | 132 | | |
110 | 133 | | |
111 | 134 | | |
112 | | - | |
| 135 | + | |
113 | 136 | | |
114 | 137 | | |
115 | 138 | | |
116 | | - | |
| 139 | + | |
117 | 140 | | |
118 | 141 | | |
119 | 142 | | |
| |||
122 | 145 | | |
123 | 146 | | |
124 | 147 | | |
125 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
126 | 177 | | |
127 | | - | |
128 | | - | |
129 | | - | |
| 178 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
0 commit comments