Beispiel #1
0
    def handle(self, *args, **options):
        filename = options['filename']
        if not filename or not os.path.exists(filename):
            raise ValueError('invalid filename')

        # create BulkUploadContractSource to associate with the new Contracts
        with open(filename, 'rb') as f:
            upload_source = BulkUploadContractSource.objects.create(
                has_been_loaded=True,
                original_file=f.read(),
                file_mime_type="text/csv",
                procurement_center=BulkUploadContractSource.SCHEDULE_70)

        Schedule70Loader().load(filename,
                                upload_source=upload_source,
                                replace=options['replace'],
                                strict=options['strict'])
Beispiel #2
0
 def test_make_contract_ok(self):
     Schedule70Loader.make_contract(self.make_row())
Beispiel #3
0
 def test_no_display_price_if_too_low(self):
     price = FEDERAL_MIN_CONTRACT_RATE - 1.0
     c = Schedule70Loader.make_contract(self.make_row(price=str(price)))
     self.assertEquals(c.hourly_rate_year1, price)
     self.assertIsNone(c.current_price)
Beispiel #4
0
 def test_sets_hourly1_and_current_price(self):
     price = 999.99
     c = Schedule70Loader.make_contract(self.make_row(price=str(price)))
     self.assertEquals(c.hourly_rate_year1, price)
     self.assertEquals(c.current_price, price)
Beispiel #5
0
 def test_cleans_labor_category(self):
     row_messy_category = self.make_row(labor_category=' Messy\nCategory')
     contract = Schedule70Loader.make_contract(row_messy_category)
     self.assertEquals(contract.labor_category, 'Messy Category')