Commit ac63ed7
committed
fix(tests): Use spec for row mocks in test_get_ad_group_bid_modifiers.py
I've updated `test_get_ad_group_bid_modifiers.py` to use the `spec`
argument when creating `MagicMock` instances for `GoogleAdsRow`
equivalents (named `mock_row` in the test). The spec includes
`'ad_group_bid_modifier'`, `'ad_group'`, and `'campaign'`.
Nested mocks for `ad_group` and `campaign` are also now created
with `spec=['id']`.
This change makes the row mocks stricter and is intended to ensure
that when `row.ad_group_bid_modifier` is accessed, it returns the
exact instance of the custom `MockAdGroupBidModifierModel` class,
rather than a generic `MagicMock`. This should resolve the
`AttributeError: type object 'MagicMock' has no attribute 'pb'`
by ensuring `type(modifier)` in the script is
`MockAdGroupBidModifierModel`.1 parent fc52f01 commit ac63ed7
File tree
1 file changed
+12
-6
lines changed- examples/advanced_operations/tests
1 file changed
+12
-6
lines changedLines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
| 91 | + | |
91 | 92 | | |
92 | | - | |
| 93 | + | |
| 94 | + | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| |||
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | | - | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| |||
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
139 | | - | |
| 143 | + | |
| 144 | + | |
140 | 145 | | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
143 | 149 | | |
144 | | - | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| |||
0 commit comments