<s> import datetime <EOL> from django . contrib . auth . models import User <EOL> from django . test import TestCase <EOL> from django . utils import timezone <EOL> from . import models <EOL> class TagTests ( TestCase ) : <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT:Name>' , models . Tag ( name = '<STR_LIT:Name>' , color = '<STR_LIT>' ) . __str__ ( ) ) <EOL> def test_save ( self ) : <EOL> """<STR_LIT>""" <EOL> tag = models . Tag ( name = '<STR_LIT>' , color = '<STR_LIT>' ) <EOL> tag . save ( ) <EOL> self . assertEqual ( '<STR_LIT>' , tag . color ) <EOL> class PersonTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . person_1 = models . Person ( first_name = '<STR_LIT:f>' , last_name = '<STR_LIT:l>' , email = '<STR_LIT>' , role = models . Person . MANAGER_ROLE ) <EOL> self . person_1 . phone_work = '<STR_LIT>' <EOL> self . person_1 . phone_mobile = '<STR_LIT>' <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . person_1 . __str__ ( ) ) <EOL> def test_save ( self ) : <EOL> """<STR_LIT>""" <EOL> self . person_1 . save ( ) <EOL> self . assertEqual ( '<STR_LIT>' , self . person_1 . phone_work ) <EOL> self . assertEqual ( '<STR_LIT>' , self . person_1 . phone_mobile ) <EOL> class OrganizationTests ( TestCase ) : <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT:Name>' , models . Organization ( name = '<STR_LIT:Name>' ) . __str__ ( ) ) <EOL> class DataElementTests ( TestCase ) : <EOL> def test_str ( self ) : <EOL> element = models . DataElement ( name = '<STR_LIT>' , description = '<STR_LIT>' , category = models . DataElement . GLOBAL_CATEGORY , weight = <NUM_LIT:5> ) <EOL> self . assertEqual ( '<STR_LIT>' , element . __str__ ( ) ) <EOL> class TechnologyTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . tech_1 = models . Technology ( name = '<STR_LIT>' , category = models . Technology . PROGRAMMING_LANGUAGE_CATEGORY , <EOL> description = '<STR_LIT>' , reference = '<STR_LIT>' ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . tech_1 . __str__ ( ) ) <EOL> class RegulationTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . reg_1 = models . Regulation ( name = '<STR_LIT>' , acronym = '<STR_LIT>' , <EOL> category = models . Regulation . FINANCE_CATEGORY , jurisdiction = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , reference = '<STR_LIT>' ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . reg_1 . __str__ ( ) ) <EOL> class ServiceLevelAgreementTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . sla_1 = models . ServiceLevelAgreement ( name = '<STR_LIT>' , description = '<STR_LIT>' ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . sla_1 . __str__ ( ) ) <EOL> class ThreadFixTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . tf_1 = models . ThreadFix ( name = '<STR_LIT>' , host = '<STR_LIT>' , api_key = '<STR_LIT:key>' , verify_ssl = True ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . tf_1 . __str__ ( ) ) <EOL> class ApplicationTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . org_1 = models . Organization ( name = '<STR_LIT>' ) <EOL> self . org_1 . save ( ) <EOL> self . de_fname = models . DataElement ( name = '<STR_LIT>' , category = models . DataElement . PERSONAL_CATEGORY , weight = <NUM_LIT> ) <EOL> self . de_fname . save ( ) <EOL> self . de_lname = models . DataElement ( name = '<STR_LIT>' , category = models . DataElement . GLOBAL_CATEGORY , weight = <NUM_LIT> ) <EOL> self . de_lname . save ( ) <EOL> self . de_gender = models . DataElement ( name = '<STR_LIT>' , category = models . DataElement . PERSONAL_CATEGORY , weight = <NUM_LIT> ) <EOL> self . de_gender . save ( ) <EOL> self . de_age = models . DataElement ( name = '<STR_LIT>' , category = models . DataElement . PERSONAL_CATEGORY , weight = <NUM_LIT> ) <EOL> self . de_age . save ( ) <EOL> self . de_edu = models . DataElement ( name = '<STR_LIT>' , category = models . DataElement . PERSONAL_CATEGORY , weight = <NUM_LIT> ) <EOL> self . de_edu . save ( ) <EOL> self . app_1 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_1 . save ( ) <EOL> self . app_1 . data_elements . add ( self . de_fname ) <EOL> self . app_1 . data_elements . add ( self . de_gender ) <EOL> self . app_1 . save ( ) <EOL> self . app_2 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_2 . save ( ) <EOL> self . app_2 . data_elements . add ( self . de_fname ) <EOL> self . app_2 . data_elements . add ( self . de_lname ) <EOL> self . app_2 . data_elements . add ( self . de_gender ) <EOL> self . app_2 . created_date = timezone . utc . localize ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:30> ) ) <EOL> self . app_2 . save ( ) <EOL> self . app_3 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_3 . save ( ) <EOL> self . app_3 . data_elements . add ( self . de_age ) <EOL> self . app_3 . data_elements . add ( self . de_edu ) <EOL> self . app_3 . save ( ) <EOL> self . app_4 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_4 . save ( ) <EOL> self . app_4 . data_elements . add ( self . de_fname ) <EOL> self . app_4 . data_elements . add ( self . de_lname ) <EOL> self . app_4 . data_elements . add ( self . de_edu ) <EOL> self . app_4 . save ( ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . app_1 . __str__ ( ) ) <EOL> def test_data_classification_level_1 ( self ) : <EOL> self . assertEqual ( <NUM_LIT> , self . app_1 . data_sensitivity_value ( ) ) <EOL> self . assertEqual ( models . Application . DCL_1 , self . app_1 . data_classification_level ( ) ) <EOL> def test_data_classification_level_2 ( self ) : <EOL> self . assertEqual ( <NUM_LIT> , self . app_2 . data_sensitivity_value ( ) ) <EOL> self . assertEqual ( models . Application . DCL_2 , self . app_2 . data_classification_level ( ) ) <EOL> def test_data_classification_level_3 ( self ) : <EOL> self . assertEqual ( <NUM_LIT> , self . app_3 . data_sensitivity_value ( ) ) <EOL> self . assertEqual ( models . Application . DCL_3 , self . app_3 . data_classification_level ( ) ) <EOL> def test_data_classification_level_4 ( self ) : <EOL> self . assertEqual ( <NUM_LIT> , self . app_4 . data_sensitivity_value ( ) ) <EOL> self . assertEqual ( models . Application . DCL_4 , self . app_4 . data_classification_level ( ) ) <EOL> def test_is_new ( self ) : <EOL> self . assertEqual ( True , self . app_1 . is_new ( ) ) <EOL> self . assertEqual ( False , self . app_2 . is_new ( ) ) <EOL> class ThreadFixMetricsTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . tfm_1 = models . ThreadFixMetrics ( critical_count = <NUM_LIT:1> , high_count = <NUM_LIT:4> , medium_count = <NUM_LIT:16> , low_count = <NUM_LIT:10> , <EOL> informational_count = <NUM_LIT:3> ) <EOL> def test_total ( self ) : <EOL> self . assertEqual ( <NUM_LIT> , self . tfm_1 . total ( ) ) <EOL> class RelationTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . org_1 = models . Organization ( name = '<STR_LIT>' ) <EOL> self . org_1 . save ( ) <EOL> self . app_1 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_1 . save ( ) <EOL> self . per_1 = models . Person ( first_name = '<STR_LIT>' , last_name = '<STR_LIT>' , email = '<STR_LIT>' , role = models . Person . MANAGER_ROLE ) <EOL> self . per_1 . save ( ) <EOL> self . rel_1 = models . Relation ( person = self . per_1 , application = self . app_1 ) <EOL> self . rel_1 . save ( ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . rel_1 . __str__ ( ) ) <EOL> class EnvironmentTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . org_1 = models . Organization ( name = '<STR_LIT>' ) <EOL> self . org_1 . save ( ) <EOL> self . app_1 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_1 . save ( ) <EOL> self . env_1 = models . Environment ( environment_type = models . Environment . PRODUCTION_ENVIRONMENT , <EOL> application = self . app_1 ) <EOL> self . env_1 . save ( ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . env_1 . __str__ ( ) ) <EOL> class EnvironmentLocationTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . org_1 = models . Organization ( name = '<STR_LIT>' ) <EOL> self . org_1 . save ( ) <EOL> self . app_1 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_1 . save ( ) <EOL> self . env_1 = models . Environment ( environment_type = models . Environment . PRODUCTION_ENVIRONMENT , <EOL> application = self . app_1 ) <EOL> self . env_1 . save ( ) <EOL> self . el_1 = models . EnvironmentLocation ( location = '<STR_LIT>' , environment = self . env_1 ) <EOL> self . el_1 . save ( ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . el_1 . __str__ ( ) ) <EOL> class EnvironmentCredentialsTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . org_1 = models . Organization ( name = '<STR_LIT>' ) <EOL> self . org_1 . save ( ) <EOL> self . app_1 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_1 . save ( ) <EOL> self . env_1 = models . Environment ( environment_type = models . Environment . PRODUCTION_ENVIRONMENT , <EOL> application = self . app_1 ) <EOL> self . env_1 . save ( ) <EOL> self . ec_1 = models . EnvironmentCredentials ( username = '<STR_LIT:user>' , password = '<STR_LIT>' , environment = self . env_1 ) <EOL> self . ec_1 . save ( ) <EOL> class EngagementTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . org_1 = models . Organization ( name = '<STR_LIT>' ) <EOL> self . org_1 . save ( ) <EOL> self . app_1 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_1 . save ( ) <EOL> self . eng_1 = models . Engagement ( start_date = datetime . date . today ( ) , <EOL> end_date = datetime . date . today ( ) + datetime . timedelta ( days = <NUM_LIT:5> ) , <EOL> application = self . app_1 ) <EOL> self . eng_1 . save ( ) <EOL> def test_save_pending_to_open ( self ) : <EOL> self . eng_1 . status = models . Engagement . PENDING_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . eng_1 . status = models . Engagement . OPEN_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertNotEqual ( None , self . eng_1 . open_date ) <EOL> self . assertEqual ( None , self . eng_1 . close_date ) <EOL> def test_save_pending_to_closed ( self ) : <EOL> self . eng_1 . status = models . Engagement . PENDING_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . eng_1 . status = models . Engagement . CLOSED_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertNotEqual ( None , self . eng_1 . open_date ) <EOL> self . assertNotEqual ( None , self . eng_1 . close_date ) <EOL> self . assertEqual ( self . eng_1 . open_date , self . eng_1 . close_date ) <EOL> def test_save_open_to_pending ( self ) : <EOL> self . eng_1 . status = models . Engagement . OPEN_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . eng_1 . status = models . Engagement . PENDING_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertEqual ( None , self . eng_1 . open_date ) <EOL> self . assertEqual ( None , self . eng_1 . close_date ) <EOL> def test_save_open_to_closed ( self ) : <EOL> self . eng_1 . status = models . Engagement . OPEN_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . eng_1 . status = models . Engagement . CLOSED_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertNotEqual ( None , self . eng_1 . open_date ) <EOL> self . assertNotEqual ( None , self . eng_1 . close_date ) <EOL> self . assertNotEqual ( self . eng_1 . open_date , self . eng_1 . close_date ) <EOL> def test_save_closed_to_pending ( self ) : <EOL> self . eng_1 . status = models . Engagement . CLOSED_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . eng_1 . status = models . Engagement . PENDING_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertEqual ( None , self . eng_1 . open_date ) <EOL> self . assertEqual ( None , self . eng_1 . close_date ) <EOL> def test_save_closed_to_open ( self ) : <EOL> self . eng_1 . status = models . Engagement . CLOSED_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . eng_1 . status = models . Engagement . OPEN_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertNotEqual ( None , self . eng_1 . open_date ) <EOL> self . assertEqual ( None , self . eng_1 . close_date ) <EOL> def test_is_pending ( self ) : <EOL> self . eng_1 . status = models . Engagement . PENDING_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertTrue ( self . eng_1 . is_pending ( ) ) <EOL> self . assertFalse ( self . eng_1 . is_open ( ) ) <EOL> self . assertFalse ( self . eng_1 . is_closed ( ) ) <EOL> def test_is_open ( self ) : <EOL> self . eng_1 . status = models . Engagement . OPEN_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertFalse ( self . eng_1 . is_pending ( ) ) <EOL> self . assertTrue ( self . eng_1 . is_open ( ) ) <EOL> self . assertFalse ( self . eng_1 . is_closed ( ) ) <EOL> def test_is_closed ( self ) : <EOL> self . eng_1 . status = models . Engagement . CLOSED_STATUS <EOL> self . eng_1 . save ( ) <EOL> self . assertFalse ( self . eng_1 . is_pending ( ) ) <EOL> self . assertFalse ( self . eng_1 . is_open ( ) ) <EOL> self . assertTrue ( self . eng_1 . is_closed ( ) ) <EOL> def test_is_ready_for_work ( self ) : <EOL> self . eng_1 . status = models . Engagement . PENDING_STATUS <EOL> self . eng_1 . start_date = datetime . date . today ( ) <EOL> self . eng_1 . save ( ) <EOL> self . assertTrue ( self . eng_1 . is_ready_for_work ( ) ) <EOL> self . eng_1 . start_date = datetime . date . today ( ) + datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . eng_1 . save ( ) <EOL> self . assertFalse ( self . eng_1 . is_ready_for_work ( ) ) <EOL> def test_is_past_due ( self ) : <EOL> self . eng_1 . status = models . Engagement . PENDING_STATUS <EOL> self . eng_1 . end_date = datetime . date . today ( ) - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . eng_1 . save ( ) <EOL> self . assertTrue ( self . eng_1 . is_past_due ( ) ) <EOL> self . eng_1 . end_date = datetime . date . today ( ) <EOL> self . eng_1 . save ( ) <EOL> self . assertFalse ( self . eng_1 . is_past_due ( ) ) <EOL> self . eng_1 . status = models . Engagement . OPEN_STATUS <EOL> self . eng_1 . end_date = datetime . date . today ( ) - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . eng_1 . save ( ) <EOL> self . assertTrue ( self . eng_1 . is_past_due ( ) ) <EOL> self . eng_1 . end_date = datetime . date . today ( ) + datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . eng_1 . save ( ) <EOL> self . assertFalse ( self . eng_1 . is_past_due ( ) ) <EOL> class ActivityTypeTests ( TestCase ) : <EOL> def test_str ( self ) : <EOL> self . at_1 = models . ActivityType ( name = '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , self . at_1 . __str__ ( ) ) <EOL> class ActivityTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . org_1 = models . Organization ( name = '<STR_LIT>' ) <EOL> self . org_1 . save ( ) <EOL> self . app_1 = models . Application ( name = '<STR_LIT>' , organization = self . org_1 ) <EOL> self . app_1 . save ( ) <EOL> now = datetime . date . today ( ) <EOL> self . en_1 = models . Engagement ( start_date = now , end_date = now + datetime . timedelta ( days = <NUM_LIT:5> ) , application = self . app_1 ) <EOL> self . en_1 . save ( ) <EOL> self . at_1 = models . ActivityType ( name = '<STR_LIT>' ) <EOL> self . at_1 . save ( ) <EOL> self . ac_1 = models . Activity ( engagement = self . en_1 , activity_type = self . at_1 ) <EOL> self . ac_1 . save ( ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , self . ac_1 . __str__ ( ) ) <EOL> def test_save_pending_to_open ( self ) : <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . status = models . Activity . OPEN_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertNotEqual ( None , self . ac_1 . open_date ) <EOL> self . assertEqual ( None , self . ac_1 . close_date ) <EOL> self . assertTrue ( self . ac_1 . engagement . is_open ( ) ) <EOL> def test_save_pending_to_closed ( self ) : <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertNotEqual ( None , self . ac_1 . open_date ) <EOL> self . assertNotEqual ( None , self . ac_1 . close_date ) <EOL> self . assertEqual ( self . ac_1 . open_date , self . ac_1 . close_date ) <EOL> def test_save_open_to_pending ( self ) : <EOL> self . ac_1 . status = models . Activity . OPEN_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertEqual ( None , self . ac_1 . open_date ) <EOL> self . assertEqual ( None , self . ac_1 . close_date ) <EOL> def test_save_open_to_closed ( self ) : <EOL> self . ac_1 . status = models . Activity . OPEN_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertNotEqual ( None , self . ac_1 . open_date ) <EOL> self . assertNotEqual ( None , self . ac_1 . close_date ) <EOL> self . assertNotEqual ( self . ac_1 . open_date , self . ac_1 . close_date ) <EOL> def test_save_closed_to_pending ( self ) : <EOL> self . ac_1 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertEqual ( None , self . ac_1 . open_date ) <EOL> self . assertEqual ( None , self . ac_1 . close_date ) <EOL> def test_save_closed_to_open ( self ) : <EOL> self . ac_1 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . status = models . Activity . OPEN_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertNotEqual ( None , self . ac_1 . open_date ) <EOL> self . assertEqual ( None , self . ac_1 . close_date ) <EOL> self . assertTrue ( self . ac_1 . engagement . is_open ( ) ) <EOL> def test_save_close_parent_engagement_solo ( self ) : <EOL> """<STR_LIT>""" <EOL> now = datetime . date . today ( ) <EOL> self . en_2 = models . Engagement ( start_date = now , end_date = now + datetime . timedelta ( days = <NUM_LIT:5> ) , application = self . app_1 ) <EOL> self . en_2 . save ( ) <EOL> self . en_2 . status = models . Engagement . OPEN_STATUS <EOL> self . en_2 . save ( ) <EOL> self . ac_2 = models . Activity ( engagement = self . en_2 , activity_type = self . at_1 ) <EOL> self . ac_2 . save ( ) <EOL> self . ac_2 . status = models . Activity . OPEN_STATUS <EOL> self . ac_2 . save ( ) <EOL> self . ac_2 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_2 . save ( ) <EOL> self . assertEqual ( models . Engagement . CLOSED_STATUS , self . ac_2 . engagement . status ) <EOL> def test_save_close_parent_engagement_multiple ( self ) : <EOL> """<STR_LIT>""" <EOL> now = datetime . date . today ( ) <EOL> self . en_3 = models . Engagement ( start_date = now , end_date = now + datetime . timedelta ( days = <NUM_LIT:5> ) , application = self . app_1 ) <EOL> self . en_3 . save ( ) <EOL> self . en_3 . status = models . Engagement . OPEN_STATUS <EOL> self . en_3 . save ( ) <EOL> self . ac_3 = models . Activity ( engagement = self . en_3 , activity_type = self . at_1 ) <EOL> self . ac_3 . save ( ) <EOL> self . ac_3 . status = models . Activity . OPEN_STATUS <EOL> self . ac_3 . save ( ) <EOL> self . ac_4 = models . Activity ( engagement = self . en_3 , activity_type = self . at_1 ) <EOL> self . ac_4 . save ( ) <EOL> self . ac_4 . status = models . Activity . OPEN_STATUS <EOL> self . ac_4 . save ( ) <EOL> self . ac_3 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_3 . save ( ) <EOL> self . assertEqual ( models . Engagement . OPEN_STATUS , self . en_3 . status ) <EOL> self . ac_4 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_4 . save ( ) <EOL> self . assertEqual ( models . Engagement . CLOSED_STATUS , self . en_3 . status ) <EOL> def test_is_pending ( self ) : <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertTrue ( self . ac_1 . is_pending ( ) ) <EOL> self . assertFalse ( self . ac_1 . is_open ( ) ) <EOL> self . assertFalse ( self . ac_1 . is_closed ( ) ) <EOL> def test_is_open ( self ) : <EOL> self . ac_1 . status = models . Activity . OPEN_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertFalse ( self . ac_1 . is_pending ( ) ) <EOL> self . assertTrue ( self . ac_1 . is_open ( ) ) <EOL> self . assertFalse ( self . ac_1 . is_closed ( ) ) <EOL> def test_is_closed ( self ) : <EOL> self . ac_1 . status = models . Activity . CLOSED_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . assertFalse ( self . ac_1 . is_pending ( ) ) <EOL> self . assertFalse ( self . ac_1 . is_open ( ) ) <EOL> self . assertTrue ( self . ac_1 . is_closed ( ) ) <EOL> def test_is_ready_for_work ( self ) : <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . engagement . start_date = datetime . date . today ( ) <EOL> self . ac_1 . engagement . save ( ) <EOL> self . assertTrue ( self . ac_1 . is_ready_for_work ( ) ) <EOL> self . ac_1 . engagement . start_date = datetime . date . today ( ) + datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . ac_1 . engagement . save ( ) <EOL> self . assertFalse ( self . ac_1 . is_ready_for_work ( ) ) <EOL> def test_is_past_due ( self ) : <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . engagement . end_date = datetime . date . today ( ) - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . ac_1 . engagement . save ( ) <EOL> self . assertTrue ( self . ac_1 . is_past_due ( ) ) <EOL> self . ac_1 . engagement . end_date = datetime . date . today ( ) <EOL> self . ac_1 . engagement . save ( ) <EOL> self . assertFalse ( self . ac_1 . is_past_due ( ) ) <EOL> self . ac_1 . status = models . Activity . PENDING_STATUS <EOL> self . ac_1 . save ( ) <EOL> self . ac_1 . engagement . end_date = datetime . date . today ( ) - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . ac_1 . engagement . save ( ) <EOL> self . assertTrue ( self . ac_1 . is_past_due ( ) ) <EOL> self . ac_1 . engagement . end_date = datetime . date . today ( ) + datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> self . ac_1 . engagement . save ( ) <EOL> self . assertFalse ( self . ac_1 . is_past_due ( ) ) <EOL> class CommentTests ( TestCase ) : <EOL> def test_str ( self ) : <EOL> self . user_1 = User . objects . create ( username = '<STR_LIT>' , password = '<STR_LIT>' , email = '<STR_LIT>' ) <EOL> self . user_1 . save ( ) <EOL> self . c_1 = models . Comment ( message = '<STR_LIT>' , user = self . user_1 ) <EOL> self . assertEqual ( '<STR_LIT>' , self . c_1 . __str__ ( ) ) </s>
