@@ -66,6 +66,13 @@ class O(TimeTrackingMixin):
66
66
self .assertTrue (hasattr (obj , 'add_spent_time' ))
67
67
self .assertTrue (hasattr (obj , 'reset_spent_time' ))
68
68
69
+ def test_set_mixin (self ):
70
+ class O (SetMixin ):
71
+ pass
72
+
73
+ obj = O ()
74
+ self .assertTrue (hasattr (obj , 'set' ))
75
+
69
76
70
77
class TestMetaMixins (unittest .TestCase ):
71
78
def test_retrieve_mixin (self ):
@@ -409,3 +416,21 @@ def resp_cont(url, request):
409
416
obj .save ()
410
417
self .assertEqual (obj ._attrs ['foo' ], 'baz' )
411
418
self .assertDictEqual (obj ._updated_attrs , {})
419
+
420
+ def test_set_mixin (self ):
421
+ class M (SetMixin , FakeManager ):
422
+ pass
423
+
424
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = '/api/v4/tests/foo' ,
425
+ method = "put" )
426
+ def resp_cont (url , request ):
427
+ headers = {'Content-Type' : 'application/json' }
428
+ content = '{"key": "foo", "value": "bar"}'
429
+ return response (200 , content , headers , None , 5 , request )
430
+
431
+ with HTTMock (resp_cont ):
432
+ mgr = M (self .gl )
433
+ obj = mgr .set ('foo' , 'bar' )
434
+ self .assertIsInstance (obj , FakeObject )
435
+ self .assertEqual (obj .key , 'foo' )
436
+ self .assertEqual (obj .value , 'bar' )
0 commit comments