@@ -131,7 +131,9 @@ def resp_cont(url, request):
131
131
132
132
def test_create_mixin_missing_attrs (gl ):
133
133
class M (CreateMixin , FakeManager ):
134
- _create_attrs = (("foo" ,), ("bar" , "baz" ))
134
+ _create_attrs = base .RequiredOptional (
135
+ required = ("foo" ,), optional = ("bar" , "baz" )
136
+ )
135
137
136
138
mgr = M (gl )
137
139
data = {"foo" : "bar" , "baz" : "blah" }
@@ -145,8 +147,10 @@ class M(CreateMixin, FakeManager):
145
147
146
148
def test_create_mixin (gl ):
147
149
class M (CreateMixin , FakeManager ):
148
- _create_attrs = (("foo" ,), ("bar" , "baz" ))
149
- _update_attrs = (("foo" ,), ("bam" ,))
150
+ _create_attrs = base .RequiredOptional (
151
+ required = ("foo" ,), optional = ("bar" , "baz" )
152
+ )
153
+ _update_attrs = base .RequiredOptional (required = ("foo" ,), optional = ("bam" ,))
150
154
151
155
@urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4/tests" , method = "post" )
152
156
def resp_cont (url , request ):
@@ -164,8 +168,10 @@ def resp_cont(url, request):
164
168
165
169
def test_create_mixin_custom_path (gl ):
166
170
class M (CreateMixin , FakeManager ):
167
- _create_attrs = (("foo" ,), ("bar" , "baz" ))
168
- _update_attrs = (("foo" ,), ("bam" ,))
171
+ _create_attrs = base .RequiredOptional (
172
+ required = ("foo" ,), optional = ("bar" , "baz" )
173
+ )
174
+ _update_attrs = base .RequiredOptional (required = ("foo" ,), optional = ("bam" ,))
169
175
170
176
@urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4/others" , method = "post" )
171
177
def resp_cont (url , request ):
@@ -183,7 +189,9 @@ def resp_cont(url, request):
183
189
184
190
def test_update_mixin_missing_attrs (gl ):
185
191
class M (UpdateMixin , FakeManager ):
186
- _update_attrs = (("foo" ,), ("bar" , "baz" ))
192
+ _update_attrs = base .RequiredOptional (
193
+ required = ("foo" ,), optional = ("bar" , "baz" )
194
+ )
187
195
188
196
mgr = M (gl )
189
197
data = {"foo" : "bar" , "baz" : "blah" }
@@ -197,8 +205,10 @@ class M(UpdateMixin, FakeManager):
197
205
198
206
def test_update_mixin (gl ):
199
207
class M (UpdateMixin , FakeManager ):
200
- _create_attrs = (("foo" ,), ("bar" , "baz" ))
201
- _update_attrs = (("foo" ,), ("bam" ,))
208
+ _create_attrs = base .RequiredOptional (
209
+ required = ("foo" ,), optional = ("bar" , "baz" )
210
+ )
211
+ _update_attrs = base .RequiredOptional (required = ("foo" ,), optional = ("bam" ,))
202
212
203
213
@urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4/tests/42" , method = "put" )
204
214
def resp_cont (url , request ):
@@ -216,8 +226,10 @@ def resp_cont(url, request):
216
226
217
227
def test_update_mixin_no_id (gl ):
218
228
class M (UpdateMixin , FakeManager ):
219
- _create_attrs = (("foo" ,), ("bar" , "baz" ))
220
- _update_attrs = (("foo" ,), ("bam" ,))
229
+ _create_attrs = base .RequiredOptional (
230
+ required = ("foo" ,), optional = ("bar" , "baz" )
231
+ )
232
+ _update_attrs = base .RequiredOptional (required = ("foo" ,), optional = ("bam" ,))
221
233
222
234
@urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4/tests" , method = "put" )
223
235
def resp_cont (url , request ):
0 commit comments