Exemplo n.º 1
0
    def test_get_filing_actions(self):
        wft = self.stub()
        self.mock_tool(wft, 'portal_workflow')

        # dossier not resolved yet without a filing no
        dossier1 = self.stub_dossier()
        self.expect(dossier1.filing_no).result(None)
        self.expect(wft.getInfoFor(dossier1, 'review_state',
                                   None)).result('dossier-state-active')

        # dossier not resolved yet with a not valid filing no
        dossier2 = self.stub_dossier()
        self.expect(dossier2.filing_no).result('FAKE_NUMBER')
        self.expect(wft.getInfoFor(dossier2, 'review_state',
                                   None)).result('dossier-state-active')

        # dossier not resolved yet with a valid filing no
        dossier3 = self.stub_dossier()
        self.expect(dossier3.filing_no).result('TEST A-Amt-2011-2')
        self.expect(wft.getInfoFor(dossier3, 'review_state',
                                   None)).result('dossier-state-active')

        # dossier allready rsolved no filing
        dossier4 = self.stub_dossier()
        self.expect(dossier4.filing_no).result(None)
        self.expect(wft.getInfoFor(dossier4, 'review_state',
                                   None)).result('dossier-state-resolved')

        self.replay()

        # dossier not resolved yet without a filing no
        actions = get_filing_actions(dossier1)
        self.assertEquals(actions.by_token.keys(),
                          [ONLY_RESOLVE, RESOLVE_AND_NUMBER])
        self.assertEquals(actions.by_value.keys(),
                          [METHOD_RESOLVING_AND_FILING, METHOD_RESOLVING])

        # dossier not resolved yet but with a filing no
        actions = get_filing_actions(dossier2)
        self.assertEquals(actions.by_token.keys(),
                          [ONLY_RESOLVE, RESOLVE_AND_NUMBER])
        self.assertEquals(actions.by_value.keys(),
                          [METHOD_RESOLVING_AND_FILING, METHOD_RESOLVING])

        # dossier not resolved yet but with a filing no
        actions = get_filing_actions(dossier3)
        self.assertEquals(
            actions.by_token.keys(),
            [RESOLVE_WITH_EXISTING_NUMBER, RESOLVE_WITH_NEW_NUMBER])
        self.assertEquals(
            actions.by_value.keys(),
            [METHOD_RESOLVING_AND_FILING, METHOD_RESOLVING_EXISTING_FILING])

        # dossier allready resolved but without filing
        actions = get_filing_actions(dossier4)
        self.assertEquals(actions.by_token.keys(), [ONLY_NUMBER])
        self.assertEquals(actions.by_value.keys(), [METHOD_FILING])
Exemplo n.º 2
0
    def test_get_filing_actions(self):
        wft = self.stub()
        self.mock_tool(wft, 'portal_workflow')

        #dossier not resolved yet without a filing no
        dossier1 = self.stub_dossier()
        self.expect(dossier1.filing_no).result(None)
        self.expect(wft.getInfoFor(dossier1, 'review_state', None)).result(
            'dossier-state-active')

        #dossier not resolved yet with a not valid filing no
        dossier2 = self.stub_dossier()
        self.expect(dossier2.filing_no).result('FAKE_NUMBER')
        self.expect(wft.getInfoFor(dossier2, 'review_state', None)).result(
            'dossier-state-active')

        #dossier not resolved yet with a valid filing no
        dossier3 = self.stub_dossier()
        self.expect(dossier3.filing_no).result('TEST A-Amt-2011-2')
        self.expect(wft.getInfoFor(dossier3, 'review_state', None)).result(
            'dossier-state-active')

        # dossier allready rsolved no filing
        dossier4 = self.stub_dossier()
        self.expect(dossier4.filing_no).result(None)
        self.expect(wft.getInfoFor(dossier4, 'review_state', None)).result(
            'dossier-state-resolved')

        self.replay()

        # dossier not resolved yet without a filing no
        actions = get_filing_actions(dossier1)
        self.assertEquals(actions.by_token.keys(),
                          [ONLY_RESOLVE, RESOLVE_AND_NUMBER])
        self.assertEquals(actions.by_value.keys(),
                          [METHOD_RESOLVING_AND_FILING, METHOD_RESOLVING])

        #dossier not resolved yet but with a filing no
        actions = get_filing_actions(dossier2)
        self.assertEquals(actions.by_token.keys(),
                          [ONLY_RESOLVE, RESOLVE_AND_NUMBER])
        self.assertEquals(actions.by_value.keys(),
                          [METHOD_RESOLVING_AND_FILING, METHOD_RESOLVING])

        #dossier not resolved yet but with a filing no
        actions = get_filing_actions(dossier3)
        self.assertEquals(
            actions.by_token.keys(),
            [RESOLVE_WITH_EXISTING_NUMBER, RESOLVE_WITH_NEW_NUMBER])
        self.assertEquals(actions.by_value.keys(),
                          [METHOD_RESOLVING_AND_FILING, METHOD_RESOLVING_EXISTING_FILING])

        # dossier allready resolved but without filing
        actions = get_filing_actions(dossier4)
        self.assertEquals(actions.by_token.keys(),[ONLY_NUMBER])
        self.assertEquals(actions.by_value.keys(),[METHOD_FILING])