|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
| 15 | +fromreimportmatch |
15 | 16 | importpytest |
16 | 17 |
|
17 | 18 | fromgoogle.api_coreimportclient_options |
@@ -144,10 +145,21 @@ def test_from_dict_bad_argument(): |
144 | 145 |
|
145 | 146 |
|
146 | 147 | deftest_repr(): |
147 | | -options=client_options.ClientOptions(api_endpoint="foo.googleapis.com") |
148 | | - |
149 | | -assert ( |
150 | | -repr(options) |
151 | | -=="ClientOptions: {'api_endpoint': 'foo.googleapis.com', 'client_cert_source': None, 'client_encrypted_cert_source': None, 'api_key': None}" |
152 | | -or"ClientOptions: {'client_encrypted_cert_source': None, 'client_cert_source': None, 'api_endpoint': 'foo.googleapis.com', 'api_key': None}" |
| 148 | +expected_keys=set( |
| 149 | + [ |
| 150 | +"api_endpoint", |
| 151 | +"client_cert_source", |
| 152 | +"client_encrypted_cert_source", |
| 153 | +"quota_project_id", |
| 154 | +"credentials_file", |
| 155 | +"scopes", |
| 156 | +"api_key", |
| 157 | +"api_audience", |
| 158 | + ] |
153 | 159 | ) |
| 160 | +options=client_options.ClientOptions(api_endpoint="foo.googleapis.com") |
| 161 | +options_repr=repr(options) |
| 162 | +options_keys=vars(options).keys() |
| 163 | +assertmatch(r"ClientOptions:",options_repr) |
| 164 | +assertmatch(r".*'api_endpoint': 'foo.googleapis.com'.*",options_repr) |
| 165 | +assertoptions_keys==expected_keys |