Esempio n. 1
0
class NOWApplicationNDAFactory(BaseFactory):
    class Meta:
        model = NOWApplicationNDA

    class Params:
        mine = factory.SubFactory('tests.factories.MineFactory', minimal=True)
        applicant = factory.SubFactory('tests.factories.NOWClientFactory')
        submitter = factory.SubFactory('tests.factories.NOWClientFactory')
        #now_application_identity = factory.SubFactory('tests.factories.NOWApplicationIdentityFactory')

    application_nda_guid = GUID
    mine_guid = factory.SelfAttribute('mine.mine_guid')
    messageid = factory.Sequence(lambda n: n)
    applicantclientid = factory.SelfAttribute('applicant.clientid')
    submitterclientid = factory.SelfAttribute('submitter.clientid')
    status = factory.LazyFunction(lambda: random.choice(
        [x.description for x in NOWApplicationStatus.get_active()]))
    submitteddate = factory.Faker('past_datetime')
    receiveddate = factory.Faker('past_datetime')
    minenumber = factory.SelfAttribute('mine.mine_no')
    originating_system = random.choice(['NROS', 'VFCBC'])

    @factory.post_generation
    def documents(obj, create, extracted, **kwargs):
        if not create:
            return

        if not isinstance(extracted, int):
            extracted = 1

        NOWDocumentFactory.create_batch(size=extracted,
                                        application=obj,
                                        **kwargs)
Esempio n. 2
0
    def test_get_application_status_codes(self, test_client, db_session,
                                          auth_headers):
        """Should return the correct number of records with a 200 response code"""

        get_resp = test_client.get(
            f'/now-applications/application-status-codes',
            headers=auth_headers['full_auth_header'])
        get_data = json.loads(get_resp.data.decode())
        assert get_resp.status_code == 200
        assert len(get_data['records']) == len(
            NOWApplicationStatus.get_active())
Esempio n. 3
0
 def get(self):
     return NOWApplicationStatus.get_active()