<s> import os <EOL> from nose . plugins . skip import SkipTest <EOL> from nose . tools import assert_equal , assert_true , assert_false , assert_not_equal <EOL> from django . contrib . auth . models import User <EOL> from desktop . lib . django_test_util import make_logged_in_client <EOL> from desktop . lib . test_utils import add_to_group , grant_access <EOL> from hadoop . pseudo_hdfs4 import is_live_cluster <EOL> from libsentry . conf import HOSTNAME , PORT , SENTRY_CONF_DIR <EOL> from libsentry . client import SentryClient <EOL> class TestWithSentry : <EOL> requires_hadoop = True <EOL> @ classmethod <EOL> def setup_class ( cls ) : <EOL> if not is_live_cluster ( ) : <EOL> raise SkipTest ( '<STR_LIT>' ) <EOL> if not os . path . exists ( os . path . join ( SENTRY_CONF_DIR . get ( ) , '<STR_LIT>' ) ) : <EOL> raise SkipTest ( '<STR_LIT>' ) <EOL> cls . client = make_logged_in_client ( username = '<STR_LIT:test>' , is_superuser = False ) <EOL> cls . user = User . objects . get ( username = '<STR_LIT:test>' ) <EOL> add_to_group ( '<STR_LIT:test>' ) <EOL> grant_access ( "<STR_LIT:test>" , "<STR_LIT:test>" , "<STR_LIT>" ) <EOL> cls . db = SentryClient ( HOSTNAME . get ( ) , PORT . get ( ) , '<STR_LIT:test>' ) <EOL> @ classmethod <EOL> def teardown_class ( cls ) : <EOL> pass <EOL> def test_get_collections ( self ) : <EOL> resp = self . db . list_sentry_roles_by_group ( ) <EOL> assert_not_equal ( <NUM_LIT:0> , resp . status . value , resp ) <EOL> assert_true ( '<STR_LIT>' in resp . status . message , resp ) <EOL> resp = self . db . list_sentry_roles_by_group ( groupName = '<STR_LIT:*>' ) <EOL> assert_equal ( <NUM_LIT:0> , resp . status . value , resp ) </s>
