<s> from __future__ import unicode_literals <EOL> import boto <EOL> import sure <EOL> from nose . tools import assert_raises <EOL> from boto . exception import BotoServerError <EOL> from moto import mock_iam <EOL> @ mock_iam ( ) <EOL> def test_create_group ( ) : <EOL> conn = boto . connect_iam ( ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> with assert_raises ( BotoServerError ) : <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> @ mock_iam ( ) <EOL> def test_get_group ( ) : <EOL> conn = boto . connect_iam ( ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> conn . get_group ( '<STR_LIT>' ) <EOL> with assert_raises ( BotoServerError ) : <EOL> conn . get_group ( '<STR_LIT>' ) <EOL> @ mock_iam ( ) <EOL> def test_get_all_groups ( ) : <EOL> conn = boto . connect_iam ( ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> groups = conn . get_all_groups ( ) [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> groups . should . have . length_of ( <NUM_LIT:2> ) <EOL> @ mock_iam ( ) <EOL> def test_add_user_to_group ( ) : <EOL> conn = boto . connect_iam ( ) <EOL> with assert_raises ( BotoServerError ) : <EOL> conn . add_user_to_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> with assert_raises ( BotoServerError ) : <EOL> conn . add_user_to_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> conn . create_user ( '<STR_LIT>' ) <EOL> conn . add_user_to_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ mock_iam ( ) <EOL> def test_remove_user_from_group ( ) : <EOL> conn = boto . connect_iam ( ) <EOL> with assert_raises ( BotoServerError ) : <EOL> conn . remove_user_from_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> conn . create_user ( '<STR_LIT>' ) <EOL> with assert_raises ( BotoServerError ) : <EOL> conn . remove_user_from_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> conn . add_user_to_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> conn . remove_user_from_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ mock_iam ( ) <EOL> def test_get_groups_for_user ( ) : <EOL> conn = boto . connect_iam ( ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> conn . create_group ( '<STR_LIT>' ) <EOL> conn . create_user ( '<STR_LIT>' ) <EOL> conn . add_user_to_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> conn . add_user_to_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> groups = conn . get_groups_for_user ( '<STR_LIT>' ) [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> groups . should . have . length_of ( <NUM_LIT:2> ) </s>
