@@ -66,6 +66,13 @@ class O(TimeTrackingMixin):
6666 self .assertTrue (hasattr (obj , 'add_spent_time' ))
6767 self .assertTrue (hasattr (obj , 'reset_spent_time' ))
6868
69+ def test_set_mixin (self ):
70+ class O (SetMixin ):
71+ pass
72+
73+ obj = O ()
74+ self .assertTrue (hasattr (obj , 'set' ))
75+
6976
7077class TestMetaMixins (unittest .TestCase ):
7178 def test_retrieve_mixin (self ):
@@ -409,3 +416,21 @@ def resp_cont(url, request):
409416 obj .save ()
410417 self .assertEqual (obj ._attrs ['foo' ], 'baz' )
411418 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