<s> from basetest import BaseToscaTest <EOL> from core . models import Site , SitePrivilege , User <EOL> class SiteTest ( BaseToscaTest ) : <EOL> tests = [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def cleanup ( self ) : <EOL> self . try_to_delete ( Site , name = "<STR_LIT>" ) <EOL> def create_site_minimal ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" ) <EOL> def create_site_privilege_tech ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) + <EOL> self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : "<STR_LIT:test>" , "<STR_LIT>" : "<STR_LIT:user>" , "<STR_LIT:password>" : "<STR_LIT>" } , <EOL> reqs = [ ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) ] ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" ) <EOL> user = User . objects . get ( email = "<STR_LIT>" ) <EOL> sps = SitePrivilege . objects . filter ( site = site , user = user ) <EOL> assert ( len ( sps ) == <NUM_LIT:1> ) <EOL> assert ( sps [ <NUM_LIT:0> ] . role . role == "<STR_LIT>" ) <EOL> def create_site_privilege_admin ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) + <EOL> self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : "<STR_LIT:test>" , "<STR_LIT>" : "<STR_LIT:user>" , "<STR_LIT:password>" : "<STR_LIT>" } , <EOL> reqs = [ ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) ] ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" ) <EOL> user = User . objects . get ( email = "<STR_LIT>" ) <EOL> sps = SitePrivilege . objects . filter ( site = site , user = user ) <EOL> assert ( len ( sps ) == <NUM_LIT:1> ) <EOL> assert ( sps [ <NUM_LIT:0> ] . role . role == "<STR_LIT>" ) <EOL> def create_site_privilege_pi ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) + <EOL> self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : "<STR_LIT:test>" , "<STR_LIT>" : "<STR_LIT:user>" , "<STR_LIT:password>" : "<STR_LIT>" } , <EOL> reqs = [ ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) ] ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" ) <EOL> user = User . objects . get ( email = "<STR_LIT>" ) <EOL> sps = SitePrivilege . objects . filter ( site = site , user = user ) <EOL> assert ( len ( sps ) == <NUM_LIT:1> ) <EOL> assert ( sps [ <NUM_LIT:0> ] . role . role == "<STR_LIT>" ) <EOL> def create_site_nocreate ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : True } ) ) <EOL> site = self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> def update_site ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> orig_site = self . assert_obj ( Site , "<STR_LIT>" , site_url = None ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : "<STR_LIT>" } ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" , site_url = "<STR_LIT>" ) <EOL> assert ( orig_site . id == site . id ) <EOL> def update_site_noupdate ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> orig_site = self . assert_obj ( Site , "<STR_LIT>" , site_url = None ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : True } ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" , site_url = None ) <EOL> assert ( orig_site . id == site . id ) <EOL> def destroy_site ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" ) <EOL> self . destroy ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> def destroy_site_nodelete ( self ) : <EOL> self . assert_noobj ( Site , "<STR_LIT>" ) <EOL> self . execute ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> site = self . assert_obj ( Site , "<STR_LIT>" ) <EOL> self . destroy ( self . make_nodetemplate ( "<STR_LIT>" , "<STR_LIT>" , <EOL> props = { "<STR_LIT>" : True } ) ) <EOL> self . assert_obj ( Site , "<STR_LIT>" ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> SiteTest ( ) </s>
