<s> from rackclient . tests import utils <EOL> from rackclient . tests . v1 import fakes <EOL> from rackclient . v1 import groups <EOL> class GroupsTest ( utils . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( GroupsTest , self ) . setUp ( ) <EOL> self . cs = fakes . FakeClient ( ) <EOL> self . group_type = groups . Group <EOL> def test_list ( self ) : <EOL> groups = self . cs . groups . list ( ) <EOL> self . cs . assert_called ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> for group in groups : <EOL> self . assertIsInstance ( group , self . group_type ) <EOL> def test_get ( self ) : <EOL> group = self . cs . groups . get ( '<STR_LIT>' ) <EOL> self . cs . assert_called ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , group . gid ) <EOL> self . assertEqual ( '<STR_LIT>' , group . user_id ) <EOL> self . assertEqual ( '<STR_LIT>' , group . project_id ) <EOL> self . assertEqual ( '<STR_LIT>' , group . name ) <EOL> self . assertEqual ( '<STR_LIT>' , group . description ) <EOL> self . assertEqual ( '<STR_LIT>' , group . status ) <EOL> def _create_body ( self , name , description ) : <EOL> return { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : name , <EOL> '<STR_LIT:description>' : description <EOL> } <EOL> } <EOL> def test_create ( self ) : <EOL> name = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> group = self . cs . groups . create ( name , description ) <EOL> body = self . _create_body ( name , description ) <EOL> self . cs . assert_called ( '<STR_LIT:POST>' , '<STR_LIT>' , body ) <EOL> self . assertIsInstance ( group , self . group_type ) <EOL> def test_update ( self ) : <EOL> gid = '<STR_LIT>' <EOL> name = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> group = self . cs . groups . update ( gid , name , description ) <EOL> body = self . _create_body ( name , description ) <EOL> self . cs . assert_called ( '<STR_LIT>' , '<STR_LIT>' , body ) <EOL> self . assertIsInstance ( group , self . group_type ) <EOL> def test_delete ( self ) : <EOL> gid = '<STR_LIT>' <EOL> self . cs . groups . delete ( gid ) <EOL> self . cs . assert_called ( '<STR_LIT>' , '<STR_LIT>' ) </s>
