Esempio n. 1
0
    def setUp(self):
        # Clear the values list cache
        cache.clear()

        try:
            document = Document.objects.get(
                document_key='FAC10005-CTR-000-EXP-LAY-4891')
            self.doc_category = document.category
        except Document.DoesNotExist:
            self.doc_category = CategoryFactory()
        contract = ContractFactory.create(number='FAC10005-CTR-CLT-TRS-00001',
                                          categories=[self.doc_category])
        self.contract_number = contract.number
        trs_content_type = ContentType.objects.get_for_model(Transmittal)
        self.trs_category = CategoryFactory(
            category_template__metadata_model=trs_content_type)

        self.tmpdir = tempfile.mkdtemp(prefix='phasetest_', suffix='_trs')
        self.incoming = join(self.tmpdir, 'incoming')
        self.tobechecked = join(self.tmpdir, 'tobechecked')
        self.accepted = join(self.tmpdir, 'accepted')
        self.rejected = join(self.tmpdir, 'rejected')

        os.mkdir(self.accepted)
        os.mkdir(self.rejected)
        os.mkdir(self.tobechecked)

        self.config = {
            'INCOMING_DIR': self.incoming,
            'REJECTED_DIR': self.rejected,
            'TO_BE_CHECKED_DIR': self.tobechecked,
            'ACCEPTED_DIR': self.accepted,
            'EMAIL_LIST': ['*****@*****.**'],
        }
Esempio n. 2
0
    def setUp(self):
        # Clear the values list cache
        cache.clear()

        try:
            document = Document.objects.get(document_key='FAC10005-CTR-000-EXP-LAY-4891')
            self.doc_category = document.category
        except Document.DoesNotExist:
            self.doc_category = CategoryFactory()
        contract = ContractFactory.create(number='FAC10005-CTR-CLT-TRS-00001',
                                          categories=[self.doc_category])
        self.contract_number = contract.number
        trs_content_type = ContentType.objects.get_for_model(Transmittal)
        self.trs_category = CategoryFactory(category_template__metadata_model=trs_content_type)

        self.tmpdir = tempfile.mkdtemp(prefix='phasetest_', suffix='_trs')
        self.incoming = join(self.tmpdir, 'incoming')
        self.tobechecked = join(self.tmpdir, 'tobechecked')
        self.accepted = join(self.tmpdir, 'accepted')
        self.rejected = join(self.tmpdir, 'rejected')

        os.mkdir(self.accepted)
        os.mkdir(self.rejected)
        os.mkdir(self.tobechecked)

        self.config = {
            'INCOMING_DIR': self.incoming,
            'REJECTED_DIR': self.rejected,
            'TO_BE_CHECKED_DIR': self.tobechecked,
            'ACCEPTED_DIR': self.accepted,
            'EMAIL_LIST': ['*****@*****.**'],
        }
Esempio n. 3
0
 def test_create_transmittal_with_unlinked_contract(self):
     """"Contract must be linked to doc category."""
     revisions = self.create_docs()
     unlinked_contract = ContractFactory()  # Non linked to the category
     junk_number = "XYZ"  # This one does not exist in db
     for contract_number in unlinked_contract.number, junk_number:
         # Both must fail
         with self.assertRaises(errors.InvalidContractNumberError):
             create_transmittal(self.category, self.dst_category, revisions,
                                contract_number, self.entity)
Esempio n. 4
0
    def setUp(self):
        super(TransmittalCreationTests, self).setUp()
        Model = ContentType.objects.get_for_model(OutgoingTransmittal)
        self.dst_category = CategoryFactory(
            category_template__metadata_model=Model)
        self.user1 = UserFactory(email='*****@*****.**',
                                 password='******',
                                 category=self.category)
        self.user2 = UserFactory(email='*****@*****.**',
                                 password='******',
                                 category=self.category)
        self.user3 = UserFactory(email='*****@*****.**',
                                 password='******',
                                 category=self.category)

        self.linked_contract = ContractFactory.create(
            categories=[self.category])
Esempio n. 5
0
 def setUp(self):
     self.category = CategoryFactory()
     self.user = UserFactory(email='*****@*****.**',
                             password='******',
                             is_superuser=True,
                             category=self.category)
     self.client.login(email=self.user.email, password='******')
     Model = ContentType.objects.get_for_model(ContractorDeliverable)
     self.category = CategoryFactory(
         category_template__metadata_model=Model)
     self.docs = [
         DocumentFactory(
             metadata_factory_class=ContractorDeliverableFactory,
             revision_factory_class=ContractorDeliverableRevisionFactory,
             category=self.category) for _ in range(1, 3)
     ]
     self.revisions = [doc.get_latest_revision() for doc in self.docs]
     self.contract = ContractFactory.create(categories=[self.category])
Esempio n. 6
0
 def setUp(self):
     self.category = CategoryFactory()
     self.user = UserFactory(
         email='*****@*****.**',
         password='******',
         is_superuser=True,
         category=self.category)
     self.client.login(email=self.user.email, password='******')
     Model = ContentType.objects.get_for_model(ContractorDeliverable)
     self.category = CategoryFactory(category_template__metadata_model=Model)
     self.docs = [
         DocumentFactory(
             metadata_factory_class=ContractorDeliverableFactory,
             revision_factory_class=ContractorDeliverableRevisionFactory,
             category=self.category)
         for _ in range(1, 3)]
     self.revisions = [doc.get_latest_revision() for doc in self.docs]
     self.contract = ContractFactory.create(
         categories=[self.category])
Esempio n. 7
0
    def setUp(self):
        super(TransmittalCreationTests, self).setUp()
        Model = ContentType.objects.get_for_model(OutgoingTransmittal)
        self.dst_category = CategoryFactory(
            category_template__metadata_model=Model)
        self.user1 = UserFactory(
            email='*****@*****.**',
            password='******',
            category=self.category)
        self.user2 = UserFactory(
            email='*****@*****.**',
            password='******',
            category=self.category)
        self.user3 = UserFactory(
            email='*****@*****.**',
            password='******',
            category=self.category)

        self.linked_contract = ContractFactory.create(
            categories=[self.category])