<s> from observertest import BaseObserverToscaTest <EOL> from core . models import Site , Deployment , Slice , ControllerSlice <EOL> class ObserverSliceTest ( BaseObserverToscaTest ) : <EOL> tests = [ "<STR_LIT>" ] <EOL> def cleanup ( self ) : <EOL> self . try_to_delete ( Slice , purge = False , name = "<STR_LIT>" ) <EOL> self . try_to_delete ( Site , purge = False , login_base = "<STR_LIT>" ) <EOL> self . run_observer ( ) <EOL> self . try_to_delete ( Slice , purge = True , name = "<STR_LIT>" ) <EOL> self . try_to_delete ( Site , purge = True , login_base = "<STR_LIT>" ) <EOL> def create_slice ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . assert_noobj ( Slice , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( self . get_usable_deployment ( ) , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : True } ) + <EOL> self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) + self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , reqs = [ ( "<STR_LIT>" , "<STR_LIT>" ) ] ) ) <EOL> testsite = self . assert_obj ( Site , "<STR_LIT>" ) <EOL> testslice = self . assert_obj ( Slice , "<STR_LIT>" ) <EOL> self . run_model_policy ( save_output = "<STR_LIT>" ) <EOL> cs = ControllerSlice . objects . filter ( slice = testslice ) <EOL> assert ( len ( cs ) == <NUM_LIT:1> ) <EOL> self . run_observer ( save_output = "<STR_LIT>" ) <EOL> testslice = self . assert_obj ( Slice , "<STR_LIT>" ) <EOL> cs = ControllerSlice . objects . filter ( slice = testslice ) <EOL> assert ( len ( cs ) == <NUM_LIT:1> ) <EOL> assert ( cs [ <NUM_LIT:0> ] . tenant_id is not None ) <EOL> assert ( cs [ <NUM_LIT:0> ] . tenant_id != "<STR_LIT>" ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> ObserverSliceTest ( ) </s>
