Commit 178e44b
Fix: Correct enum assertions in test_upload_image_asset.py
This commit resolves an AttributeError in the `test_main_success` method
of `examples/misc/tests/test_upload_image_asset.py`. The error was
`AttributeError: type object 'AssetTypeEnum' has no attribute 'IMAGE'`.
The issue occurred because the test was asserting an enum value against
the actual `AssetTypeEnum` class (e.g., `AssetTypeEnum.IMAGE`), whereas
the script `upload_image_asset.py` sets these values using the client's
enum instances (e.g., `client.enums.AssetTypeEnum.IMAGE`).
The fix involves:
1. Updating the `setUp` method to ensure that `client.enums.AssetTypeEnum.IMAGE`
and `client.enums.MimeTypeEnum.IMAGE_JPEG` are explicitly mocked to
return specific, predictable string values.
2. Modifying the assertions in `test_main_success` to compare the
operation's `type_` and `mime_type` attributes against these mocked
string values obtained from `self.mock_client.enums.AssetTypeEnum.IMAGE`
(and similarly for MimeTypeEnum), rather than the imported enum classes.1 parent d8a9dbf commit 178e44b
1 file changed
+10
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | | - | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | | - | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| |||
0 commit comments