def test_141_clientUsernameUnauthenticated(self): # make sure no username is known for this IP global_functions.host_username_clear() rules_clear() rule_append( create_rule_single_condition( "USERNAME", "[unauthenticated]" ) ) result = remote_control.run_command("wget -q -O /dev/null -t 1 --timeout=3 http://test.untangle.com/") assert (result != 0)
def test_149_clientUsernameBlank(self): username = remote_control.get_hostname() global_functions.host_username_set( username ) rules_clear() rule_append( create_rule_single_condition( "USERNAME", '' ) ) result = remote_control.run_command("wget -q -O /dev/null -t 1 --timeout=3 http://test.untangle.com/") assert (result == 0) global_functions.host_username_clear()
def test_083_tagUserBlock(self): rules_clear() username = remote_control.get_hostname() global_functions.host_username_set( username ) global_functions.user_tags_add(username,"testtag") rule_append( create_rule_single_condition( "TAGGED", "testtag" ) ) result = remote_control.run_command("wget -q -O /dev/null -t 1 --timeout=3 http://test.untangle.com/") global_functions.user_tags_clear(username) global_functions.host_username_clear() assert (result != 0)
def test_143_clientUsernameMultiple(self): username = remote_control.get_hostname() global_functions.host_username_set( username ) rules_clear() rule_append( create_rule_single_condition( "USERNAME", username + ",foobar" ) ) result1 = remote_control.run_command("wget -q -O /dev/null -t 1 --timeout=3 http://test.untangle.com/") rules_clear() rule_append( create_rule_single_condition( "USERNAME", "foobar," + username ) ) result2 = remote_control.run_command("wget -q -O /dev/null -t 1 --timeout=3 http://test.untangle.com/") global_functions.host_username_clear() assert (result1 != 0) assert (result2 != 0)