<s> from fixtures import graph , groups , permissions , session , standard_graph , users <EOL> from grouper . model_soup import Group , Request , User <EOL> from util import add_member <EOL> def test_basic_request ( graph , groups , permissions , session , standard_graph , users ) : <EOL> group_sre = groups [ "<STR_LIT>" ] <EOL> group_not_sre = [ g for name , g in groups . items ( ) if name != "<STR_LIT>" ] <EOL> assert not any ( [ group . my_requests ( status = "<STR_LIT>" ) . all ( ) for group in groups . values ( ) ] ) , "<STR_LIT>" <EOL> group_sre . add_member ( users [ "<STR_LIT>" ] , users [ "<STR_LIT>" ] , reason = "<STR_LIT>" ) <EOL> session . commit ( ) <EOL> request_not_sre = [ group . my_requests ( status = "<STR_LIT>" ) . all ( ) for group in group_not_sre ] <EOL> assert not any ( request_not_sre ) , "<STR_LIT>" <EOL> request_sre = group_sre . my_requests ( status = "<STR_LIT>" ) . all ( ) <EOL> assert len ( request_sre ) == <NUM_LIT:1> , "<STR_LIT>" <EOL> request = session . query ( Request ) . filter_by ( id = request_sre [ <NUM_LIT:0> ] . id ) . scalar ( ) <EOL> request . update_status ( users [ "<STR_LIT>" ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> session . commit ( ) <EOL> assert not any ( [ group . my_requests ( status = "<STR_LIT>" ) . all ( ) for group in groups . values ( ) ] ) , "<STR_LIT>" <EOL> def test_aggregate_request ( graph , groups , permissions , session , standard_graph , users ) : <EOL> gary = users [ "<STR_LIT>" ] <EOL> testuser = users [ "<STR_LIT>" ] <EOL> not_involved = [ user for name , user in users . items ( ) if name not in ( "<STR_LIT>" , <EOL> "<STR_LIT>" ) ] <EOL> assert not any ( [ u . my_requests_aggregate ( ) . all ( ) for u in users . values ( ) ] ) , "<STR_LIT>" <EOL> groups [ "<STR_LIT>" ] . add_member ( users [ "<STR_LIT>" ] , users [ "<STR_LIT>" ] , <EOL> reason = "<STR_LIT>" ) <EOL> session . commit ( ) <EOL> assert len ( gary . my_requests_aggregate ( ) . all ( ) ) == <NUM_LIT:1> , "<STR_LIT>" <EOL> assert not any ( [ u . my_requests_aggregate ( ) . all ( ) for u in not_involved ] ) , "<STR_LIT>" <EOL> groups [ "<STR_LIT>" ] . add_member ( users [ "<STR_LIT>" ] , users [ "<STR_LIT>" ] , <EOL> reason = "<STR_LIT>" ) <EOL> session . commit ( ) <EOL> request_gary = gary . my_requests_aggregate ( ) . all ( ) <EOL> assert len ( request_gary ) == <NUM_LIT:2> , "<STR_LIT>" <EOL> assert not any ( [ u . my_requests_aggregate ( ) . all ( ) for u in not_involved ] ) , "<STR_LIT>" <EOL> request = session . query ( Request ) . filter_by ( id = request_gary [ <NUM_LIT:0> ] . id ) . scalar ( ) <EOL> request . update_status ( users [ "<STR_LIT>" ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> session . commit ( ) <EOL> assert len ( gary . my_requests_aggregate ( ) . all ( ) ) == <NUM_LIT:1> , "<STR_LIT>" <EOL> assert not any ( [ u . my_requests_aggregate ( ) . all ( ) for u in not_involved ] ) , "<STR_LIT>" <EOL> groups [ "<STR_LIT>" ] . add_member ( users [ "<STR_LIT>" ] , users [ "<STR_LIT>" ] , <EOL> reason = "<STR_LIT>" ) <EOL> session . commit ( ) <EOL> assert len ( gary . my_requests_aggregate ( ) . all ( ) ) == <NUM_LIT:1> , "<STR_LIT>" <EOL> assert len ( users [ "<STR_LIT>" ] . my_requests_aggregate ( ) . all ( ) ) == <NUM_LIT:1> , "<STR_LIT>" <EOL> user_not_gary_oliver = [ u for n , u in users . items ( ) if n not in ( "<STR_LIT>" , "<STR_LIT>" ) ] <EOL> assert not any ( [ u . my_requests_aggregate ( ) . all ( ) for u in user_not_gary_oliver ] ) <EOL> figurehead = users [ "<STR_LIT>" ] <EOL> add_member ( groups [ "<STR_LIT>" ] , figurehead , role = "<STR_LIT>" ) <EOL> assert len ( figurehead . my_requests_aggregate ( ) . all ( ) ) == <NUM_LIT:0> , "<STR_LIT>" <EOL> groups [ "<STR_LIT>" ] . add_member ( users [ "<STR_LIT>" ] , users [ "<STR_LIT>" ] , <EOL> reason = "<STR_LIT>" ) <EOL> assert len ( figurehead . my_requests_aggregate ( ) . all ( ) ) == <NUM_LIT:1> , "<STR_LIT>" <EOL> groups [ "<STR_LIT>" ] . add_member ( users [ "<STR_LIT>" ] , users [ "<STR_LIT>" ] , <EOL> reason = "<STR_LIT>" ) <EOL> assert len ( figurehead . my_requests_aggregate ( ) . all ( ) ) == <NUM_LIT:2> , "<STR_LIT>" </s>
