<s> import logging <EOL> from django . contrib . auth . models import User <EOL> from nose . tools import assert_equal <EOL> import desktop . conf as desktop_conf <EOL> from desktop . lib . test_utils import reformat_xml <EOL> from liboozie import conf <EOL> from liboozie . types import WorkflowAction , Coordinator <EOL> from liboozie . utils import config_gen <EOL> from oozie . tests import MockOozieApi <EOL> LOG = logging . getLogger ( __name__ ) <EOL> def test_valid_external_id ( ) : <EOL> action = WorkflowAction ( MockOozieApi . JSON_WORKFLOW_LIST [ <NUM_LIT:0> ] ) <EOL> assert_equal ( '<STR_LIT>' , action . externalId ) <EOL> assert_equal ( '<STR_LIT>' , action . get_absolute_log_url ( ) ) <EOL> assert_equal ( '<STR_LIT>' , action . get_external_id_url ( ) ) <EOL> action = WorkflowAction ( MockOozieApi . JSON_WORKFLOW_LIST [ <NUM_LIT:1> ] ) <EOL> assert_equal ( '<STR_LIT:->' , action . externalId ) <EOL> assert_equal ( None , action . get_absolute_log_url ( ) ) <EOL> assert_equal ( None , action . get_external_id_url ( ) ) <EOL> action = WorkflowAction ( MockOozieApi . JSON_WORKFLOW_LIST [ <NUM_LIT:2> ] ) <EOL> assert_equal ( '<STR_LIT>' , action . externalId ) <EOL> assert_equal ( None , action . get_absolute_log_url ( ) ) <EOL> assert_equal ( None , action . get_external_id_url ( ) ) <EOL> action = WorkflowAction ( MockOozieApi . JSON_WORKFLOW_LIST [ <NUM_LIT:3> ] ) <EOL> assert_equal ( None , action . externalId ) <EOL> assert_equal ( None , action . get_absolute_log_url ( ) ) <EOL> assert_equal ( None , action . get_external_id_url ( ) ) <EOL> def aggregate_coordinator_instances ( ) : <EOL> dates = [ '<STR_LIT:1>' , '<STR_LIT:2>' , '<STR_LIT:3>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> assert_equal ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , Coordinator . aggreate ( dates ) ) <EOL> def test_config_gen ( ) : <EOL> properties = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> assert_equal ( reformat_xml ( """<STR_LIT>""" ) , reformat_xml ( config_gen ( properties ) ) ) <EOL> def test_ssl_validate ( ) : <EOL> for desktop_kwargs , conf_kwargs , expected in [ <EOL> ( { '<STR_LIT>' : False } , { '<STR_LIT>' : False } , True ) , <EOL> ( { '<STR_LIT>' : False } , { '<STR_LIT:data>' : False } , False ) , <EOL> ( { '<STR_LIT>' : False } , { '<STR_LIT:data>' : True } , True ) , <EOL> ( { '<STR_LIT:data>' : False } , { '<STR_LIT>' : False } , False ) , <EOL> ( { '<STR_LIT:data>' : False } , { '<STR_LIT:data>' : False } , False ) , <EOL> ( { '<STR_LIT:data>' : False } , { '<STR_LIT:data>' : True } , True ) , <EOL> ( { '<STR_LIT:data>' : True } , { '<STR_LIT>' : False } , True ) , <EOL> ( { '<STR_LIT:data>' : True } , { '<STR_LIT:data>' : False } , False ) , <EOL> ( { '<STR_LIT:data>' : True } , { '<STR_LIT:data>' : True } , True ) , <EOL> ] : <EOL> resets = [ <EOL> desktop_conf . SSL_VALIDATE . set_for_testing ( ** desktop_kwargs ) , <EOL> conf . SSL_CERT_CA_VERIFY . set_for_testing ( ** conf_kwargs ) , <EOL> ] <EOL> try : <EOL> assert_equal ( conf . SSL_CERT_CA_VERIFY . get ( ) , expected , <EOL> '<STR_LIT>' % ( desktop_kwargs , conf_kwargs , expected , conf . SSL_CERT_CA_VERIFY . get ( ) ) ) <EOL> finally : <EOL> for reset in resets : <EOL> reset ( ) </s>
