<s> from rack . api . v1 import groups <EOL> from rack import db <EOL> from rack import exception <EOL> from rack . openstack . common import jsonutils <EOL> from rack import test <EOL> from rack . tests . api import fakes <EOL> import copy <EOL> import uuid <EOL> import webob <EOL> GID = str ( uuid . uuid4 ( ) ) <EOL> FAKE_GROUPS = { <EOL> "<STR_LIT>" : [ <EOL> { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } , <EOL> { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } , <EOL> { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> ] <EOL> } <EOL> def fake_create ( context , kwargs ) : <EOL> return { "<STR_LIT>" : GID , <EOL> "<STR_LIT>" : context . user_id , <EOL> "<STR_LIT>" : context . project_id , <EOL> "<STR_LIT>" : kwargs [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : kwargs [ "<STR_LIT>" ] , <EOL> "<STR_LIT:status>" : "<STR_LIT>" } <EOL> def fake_update ( context , kwargs ) : <EOL> return { <EOL> "<STR_LIT>" : GID , <EOL> "<STR_LIT>" : context . user_id , <EOL> "<STR_LIT>" : context . project_id , <EOL> "<STR_LIT>" : "<STR_LIT:test>" , <EOL> "<STR_LIT>" : "<STR_LIT:test>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> def fake_delete ( context , kwargs ) : <EOL> return { <EOL> } <EOL> def fake_not_group_data_exists ( context , kwargs ) : <EOL> return { "<STR_LIT>" : "<STR_LIT>" } <EOL> def fake_not_group_data_not_exists ( context , kwargs ) : <EOL> return { } <EOL> def fake_raise_exception ( context , kwargs ) : <EOL> raise Exception ( ) <EOL> def raise_group_not_found ( context , kwargs ) : <EOL> raise exception . GroupNotFound ( gid = GID ) <EOL> def fake_group_get_all ( context , filters ) : <EOL> if not filters : <EOL> return copy . deepcopy ( FAKE_GROUPS [ "<STR_LIT>" ] ) <EOL> else : <EOL> return [ <EOL> { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : filters [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : filters [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : filters [ "<STR_LIT:status>" ] } <EOL> ] <EOL> def fake_group_get_by_gid ( context , gid ) : <EOL> return { <EOL> "<STR_LIT>" : gid , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> def get_request ( url , method , body = None ) : <EOL> req = webob . Request . blank ( url ) <EOL> req . headers [ '<STR_LIT:Content-Type>' ] = '<STR_LIT:application/json>' <EOL> req . method = method <EOL> if body is not None : <EOL> req . body = jsonutils . dumps ( body ) <EOL> return req <EOL> class GroupsTest ( test . NoDBTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( GroupsTest , self ) . setUp ( ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_create ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_group_get_all ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_group_get_by_gid ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_update ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_delete ) <EOL> self . controller = groups . Controller ( ) <EOL> self . app = fakes . wsgi_app ( ) <EOL> def test_index ( self ) : <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:GET>' ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> expected = copy . deepcopy ( FAKE_GROUPS ) <EOL> for group in expected [ "<STR_LIT>" ] : <EOL> group [ "<STR_LIT:name>" ] = group . pop ( "<STR_LIT>" ) <EOL> group [ "<STR_LIT:description>" ] = group . pop ( "<STR_LIT>" ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> self . assertEqual ( body , expected ) <EOL> def test_index_filters ( self ) : <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:GET>' ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> expected = { "<STR_LIT>" : [ <EOL> { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" } <EOL> ] } <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> self . assertEqual ( body , expected ) <EOL> def test_show ( self ) : <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:GET>' ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> expected = { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } } <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> self . assertEqual ( body , expected ) <EOL> def test_show_not_found_exception ( self ) : <EOL> self . stubs . Set ( db , "<STR_LIT>" , <EOL> raise_group_not_found ) <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT:GET>' ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> self . assertRaises ( <EOL> webob . exc . HTTPNotFound , self . controller . show , req , GID ) <EOL> def test_show_gid_is_not_uuid_format ( self ) : <EOL> gid = "<STR_LIT>" <EOL> url = '<STR_LIT>' + gid <EOL> req = get_request ( url , '<STR_LIT:GET>' ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> self . assertRaises ( <EOL> webob . exc . HTTPNotFound , self . controller . show , req , gid ) <EOL> def test_create ( self ) : <EOL> name = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : name , <EOL> "<STR_LIT:description>" : description , <EOL> } <EOL> } <EOL> expected = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : GID , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : name , <EOL> "<STR_LIT:description>" : description , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> for key in expected [ "<STR_LIT>" ] : <EOL> self . assertEqual ( body [ "<STR_LIT>" ] [ key ] , expected [ "<STR_LIT>" ] [ key ] ) <EOL> def test_create_group_name_is_whitespace ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT:U+0020>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_create_group_name_with_leading_trailing_whitespace ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> expected = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : GID , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> for key in expected [ "<STR_LIT>" ] : <EOL> self . assertEqual ( body [ "<STR_LIT>" ] [ key ] , expected [ "<STR_LIT>" ] [ key ] ) <EOL> def test_create_without_group_name ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_create_without_group_description ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> } <EOL> } <EOL> expected = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : GID , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> for key in expected [ "<STR_LIT>" ] : <EOL> self . assertEqual ( body [ "<STR_LIT>" ] [ key ] , expected [ "<STR_LIT>" ] [ key ] ) <EOL> def test_create_empty_body ( self ) : <EOL> request_body = { "<STR_LIT>" : { } } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_create_no_body ( self ) : <EOL> request_body = { } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_create_invalid_format_body ( self ) : <EOL> request_body = [ ] <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_create_check_group_name_length ( self ) : <EOL> MAX_LENGTH = <NUM_LIT:255> <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT:a>" * ( MAX_LENGTH + <NUM_LIT:1> ) , <EOL> "<STR_LIT:description>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_create_group_description_length_zero ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> expected = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : GID , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> for key in expected [ "<STR_LIT>" ] : <EOL> self . assertEqual ( body [ "<STR_LIT>" ] [ key ] , expected [ "<STR_LIT>" ] [ key ] ) <EOL> def test_create_check_group_description_length ( self ) : <EOL> MAX_LENGTH = <NUM_LIT:255> <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:a>" * ( MAX_LENGTH + <NUM_LIT:1> ) <EOL> } <EOL> } <EOL> url = '<STR_LIT>' <EOL> req = get_request ( url , '<STR_LIT:POST>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> } <EOL> } <EOL> expected = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : GID , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:name>" : "<STR_LIT:test>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:test>" , <EOL> "<STR_LIT:status>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> body = jsonutils . loads ( res . body ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> for key in request_body [ "<STR_LIT>" ] : <EOL> self . assertEqual ( body [ "<STR_LIT>" ] [ key ] , expected [ "<STR_LIT>" ] [ key ] ) <EOL> def test_update_allow_group_name_none ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:description>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> def test_update_allow_group_description_none ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> def test_update_allow_group_description_blank ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> def test_update_invalid_gid ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:description>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID + "<STR_LIT>" <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update_empty_body ( self ) : <EOL> request_body = { "<STR_LIT>" : { } } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update_no_body ( self ) : <EOL> request_body = { } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update_invalid_format_body ( self ) : <EOL> request_body = [ ] <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update_group_name_blank ( self ) : <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update_check_group_name_length ( self ) : <EOL> MAX_LENGTH = <NUM_LIT:255> <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT:a>" * ( MAX_LENGTH + <NUM_LIT:1> ) , <EOL> "<STR_LIT:description>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update_check_group_description_length ( self ) : <EOL> MAX_LENGTH = <NUM_LIT:255> <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:a>" * ( MAX_LENGTH + <NUM_LIT:1> ) <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_update_group_not_found_on_db ( self ) : <EOL> self . stubs . Set ( db , "<STR_LIT>" , raise_group_not_found ) <EOL> request_body = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:description>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' , request_body ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> self . assertRaises ( <EOL> webob . exc . HTTPNotFound , <EOL> self . controller . update , <EOL> req , <EOL> request_body , <EOL> GID ) <EOL> def test_delete_invalid_format_gid ( self ) : <EOL> url = '<STR_LIT>' + GID + "<STR_LIT>" <EOL> req = get_request ( url , '<STR_LIT>' ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> body = jsonutils . loads ( res . body ) <EOL> print ( body ) <EOL> def test_delete ( self ) : <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( <EOL> db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_delete_group_inuse_keypair ( self ) : <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_exists ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_delete_group_inuse_securitygroup ( self ) : <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_exists ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_delete_group_inuse_network ( self ) : <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( <EOL> db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_exists ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_delete_group_inuse_process ( self ) : <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( <EOL> db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_not_exists ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_not_group_data_exists ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) <EOL> def test_delete_exception ( self ) : <EOL> url = '<STR_LIT>' + GID <EOL> req = get_request ( url , '<STR_LIT>' ) <EOL> self . stubs . Set ( db , "<STR_LIT>" , fake_raise_exception ) <EOL> res = req . get_response ( self . app ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT> ) </s>
