def create_document(self): # Create the document my_document = Document(self) my_document.check_for_quotas() # Create the measures table my_document.get_duties("preferences") tariff_data = my_document.print_tariffs() # Create the quotas table my_document.get_duties("quotas") my_document.get_quota_order_numbers() my_document.get_quota_balances() my_document.get_quota_measures() my_document.get_quota_definitions() quota_data = my_document.print_quotas() context_data = { 'AGREEMENT_NAME': self.agreement.agreement_name, 'VERSION': self.agreement.version, 'AGREEMENT_DATE': self.agreement.agreement_date_long, 'AGREEMENT_DATE_SHORT': self.agreement.agreement_date_short, 'COUNTRY_NAME': self.agreement.country_name, **tariff_data, **quota_data, } # Personalise and write the document my_document.create_document(context_data) update_document_status(self.agreement, DocumentStatus.AVAILABLE)
def test_check_for_quotas_is_true(): SimpleCurrentMeasureFactory( measure_type_id='143', geographical_area_id='1234', ordernumber=1, validity_start_date=datetime.today(), ) AgreementFactory(country_name='Espana', slug='spain', country_codes=['1234']) application = Application(country_profile='spain') document = Document(application) assert document.check_for_quotas() is True