<s> from unittest . mock import patch <EOL> from orchestra . models import Iteration <EOL> from orchestra . models import Project <EOL> from orchestra . tests . helpers import OrchestraTestCase <EOL> from orchestra . tests . helpers . fixtures import setup_models <EOL> from orchestra . utils . project_properties import completed_projects <EOL> from orchestra . utils . task_lifecycle import assign_task <EOL> from orchestra . utils . task_lifecycle import submit_task <EOL> class ProjectPropertiesTestCase ( OrchestraTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( ) . setUp ( ) <EOL> setup_models ( self ) <EOL> def test_completed_projects ( self ) : <EOL> projects = Project . objects . all ( ) <EOL> initial_task = assign_task ( self . workers [ <NUM_LIT:6> ] . id , <EOL> self . tasks [ '<STR_LIT>' ] . id ) <EOL> with patch ( '<STR_LIT>' , <EOL> return_value = False ) : <EOL> initial_task = submit_task ( initial_task . id , { } , <EOL> Iteration . Status . REQUESTED_REVIEW , <EOL> self . workers [ <NUM_LIT:6> ] ) <EOL> self . assertEquals ( completed_projects ( projects ) . count ( ) , <NUM_LIT:0> ) <EOL> next_task = assign_task ( <EOL> self . workers [ <NUM_LIT:6> ] . id , <EOL> initial_task . project . tasks . order_by ( '<STR_LIT>' ) [ <NUM_LIT:0> ] . id ) <EOL> with patch ( '<STR_LIT>' , <EOL> return_value = False ) : <EOL> initial_task = submit_task ( next_task . id , { } , <EOL> Iteration . Status . REQUESTED_REVIEW , <EOL> self . workers [ <NUM_LIT:6> ] ) <EOL> self . assertEquals ( completed_projects ( projects ) . count ( ) , <NUM_LIT:0> ) <EOL> next_task = assign_task ( <EOL> self . workers [ <NUM_LIT:6> ] . id , <EOL> initial_task . project . tasks . order_by ( '<STR_LIT>' ) [ <NUM_LIT:0> ] . id ) <EOL> with patch ( '<STR_LIT>' , <EOL> return_value = False ) : <EOL> initial_task = submit_task ( next_task . id , { } , <EOL> Iteration . Status . REQUESTED_REVIEW , <EOL> self . workers [ <NUM_LIT:6> ] ) <EOL> self . assertEquals ( completed_projects ( projects ) . count ( ) , <NUM_LIT:1> ) </s>
