def test_delete_stage(self): stage = insert_a_stage() self.assertEquals(Stage.query.count(), 1) self.assertEquals(StageProperty.query.count(), 2) # deleting a stage should delete the stage and its props delete_stage(stage.id) self.assertEquals(Stage.query.count(), 0) self.assertEquals(StageProperty.query.count(), 0) # it should not delete any associated contracts stage = insert_a_stage() contract = insert_a_contract() contract.current_stage_id = stage.id db.session.commit() self.assertEquals( ContractBase.query.first().current_stage.id, stage.id ) delete_stage(stage.id) self.assertEquals( ContractBase.query.first().current_stage, None )
def test_delete_stage(self): stage = insert_a_stage() self.assertEquals(Stage.query.count(), 1) self.assertEquals(StageProperty.query.count(), 2) # deleting a stage should delete the stage and its props delete_stage(stage.id) self.assertEquals(Stage.query.count(), 0) self.assertEquals(StageProperty.query.count(), 0) # it should not delete any associated contracts stage = insert_a_stage() contract = insert_a_contract() contract.current_stage_id = stage.id db.session.commit() self.assertEquals(ContractBase.query.first().current_stage.id, stage.id) delete_stage(stage.id) self.assertEquals(ContractBase.query.first().current_stage, None)
def setUp(self): super(TestConductor, self).setUp() # create a conductor and general staff person self.conductor_role_id = insert_a_role('conductor') self.staff_role_id = insert_a_role('staff') self.conductor = insert_a_user(role=self.conductor_role_id) self.staff = insert_a_user(email='*****@*****.**', role=self.staff_role_id) # create three stages, and set up a flow between them self.stage1 = insert_a_stage(name='stage1', send_notifs=True, post_opportunities=True) self.stage2 = insert_a_stage(name='stage2', send_notifs=True, post_opportunities=False) self.stage3 = insert_a_stage(name='stage3', send_notifs=False, post_opportunities=False) self.flow = insert_a_flow(stage_ids=[self.stage1.id, self.stage2.id, self.stage3.id]) # create two contracts self.contract1 = insert_a_contract( contract_type='County', description='scuba supplies', financial_id=123, properties=[{'key': 'Spec Number', 'value': '123'}] ) self.contract2 = insert_a_contract( contract_type='County', description='scuba repair', financial_id=456, properties=[{'key': 'Spec Number', 'value': '456'}] ) self.login_user(self.conductor) self.detail_view = '/conductor/contract/{}/stage/{}'
def test_update_stage(self): stage = insert_a_stage() self.assertEquals(Stage.query.first().name, stage.name) update_stage(stage.id, {'name': 'new name'}) self.assertEquals(Stage.query.first().name, 'new name')
def setUp(self): super(TestConductor, self).setUp() # create a conductor and general staff person self.conductor_role_id = insert_a_role('conductor') self.staff_role_id = insert_a_role('staff') self.conductor = insert_a_user(role=self.conductor_role_id) self.staff = insert_a_user(email='*****@*****.**', role=self.staff_role_id) # create three stages, and set up a flow between them self.stage1 = insert_a_stage(name='stage1', send_notifs=True, post_opportunities=True) self.stage2 = insert_a_stage(name='stage2', send_notifs=True, post_opportunities=False) self.stage3 = insert_a_stage(name='stage3', send_notifs=False, post_opportunities=False) self.flow = insert_a_flow( stage_ids=[self.stage1.id, self.stage2.id, self.stage3.id]) # create two contracts self.contract1 = insert_a_contract(contract_type='County', description='scuba supplies', financial_id=123, properties=[{ 'key': 'Spec Number', 'value': '123' }]) self.contract2 = insert_a_contract(contract_type='County', description='scuba repair', financial_id=456, properties=[{ 'key': 'Spec Number', 'value': '456' }]) self.login_user(self.conductor) self.detail_view = '/conductor/contract/{}/stage/{}'
def test_get_stages(self): insert_a_stage() insert_a_stage() insert_a_stage() self.assertEquals( len(get_all_stages()), 3 )
def test_update_stage(self): stage = insert_a_stage() self.assertEquals( Stage.query.first().name, stage.name ) update_stage(stage.id, {'name': 'new name'}) self.assertEquals( Stage.query.first().name, 'new name' )
def setUp(self): super(FlowTest, self).setUp() stage1 = insert_a_stage() stage2 = insert_a_stage() self.stage_ids = [stage1.id, stage2.id]
def test_get_stages(self): insert_a_stage() insert_a_stage() insert_a_stage() self.assertEquals(len(get_all_stages()), 3)