Ejemplo n.º 1
0
    def test_change_milestone_to_not_met(self):
        manager = CeasefireMilestoneManager(Mock())
        mocked_request = Mock()
        mocked_milestone = Mock()
        mocked_contract = Mock()
        mocked_milestone.__parent__ = mocked_contract
        mocked_milestone.status = 'processing'
        mocked_request.context = mocked_milestone
        mocked_request.validated = {'data': {}}
        mocked_request.json = {'data': {'status': 'notMet'}}

        manager.change_milestone(mocked_request)

        self.assertEqual(mocked_milestone.status, 'notMet')
        self.assertEqual(mocked_contract.status, 'unsuccessful')
    def test_change_milestone_to_not_met(self):
        manager = CeasefireMilestoneManager(Mock())
        mocked_request = Mock()

        mocked_milestone = Mock()
        mocked_milestone.id = '1'
        mocked_contract = Mock()
        doc_mock = Mock()
        doc_mock.documentOf = 'milestone'
        doc_mock.relatedItem = '1'
        mocked_contract.documents = [doc_mock]

        mocked_milestone.__parent__ = mocked_contract
        mocked_milestone.status = 'processing'

        mocked_request.context = mocked_milestone
        mocked_request.validated = {'data': {}}
        mocked_request.json = {'data': {'status': 'notMet'}}

        manager.change_milestone(mocked_request)

        self.assertEqual(mocked_milestone.status, 'notMet')
        self.assertEqual(mocked_contract.status, 'pending.unsuccessful')