#NEWLINE# def test_add_groundstations( self ) : #NEWLINE# #INDENT# 'JRPC test: services.leop.groundstations.add\n        Validates the addition of an array of GroundStations to a given LEOP\n        cluster.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# launch_jrpc . add_groundstations ( 'FAKE_ID' , None , ** { #NEWLINE# #INDENT# 'request' : None , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . fail ( 'No request added, permission should not be granted' ) #NEWLINE# #UNINDENT# except django_ex . PermissionDenied : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# launch_jrpc . add_groundstations ( 'FAKE' , None , ** { #NEWLINE# #INDENT# 'request' : self . __request_1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . fail ( 'No request added, permission should not be granted' ) #NEWLINE# #UNINDENT# except django_ex . PermissionDenied : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# launch_jrpc . add_groundstations ( 'FAKE' , [ 'fake' ] , ** { #NEWLINE# #INDENT# 'request' : self . __request_2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . fail ( 'The leop cluster does not exist' ) #NEWLINE# #UNINDENT# except launch_models . Launch . DoesNotExist : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assertRaises ( Exception , launch_jrpc . add_groundstations , None , ** { #NEWLINE# #INDENT# 'request' : self . __request_2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# gss = [ self . __gs_1_id , self . __gs_2_id ] #NEWLINE# actual = launch_jrpc . add_groundstations ( self . __leop_id , gss , ** { #NEWLINE# #INDENT# 'request' : self . __request_2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# expected = { #NEWLINE# #INDENT# launch_serial . JRPC_K_LEOP_ID : self . __leop_id , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( actual , expected ) #NEWLINE# cluster = launch_models . Launch . objects . get ( identifier = self . __leop_id ) #NEWLINE# self . assertEqual ( len ( cluster . groundstations . all ( ) ) , 2 , 'Two groundstations should be part of this cluster object' )