

def test_incomplete_report_submission(self):
    self.client.login(username=self.username5, password=self.password5)
    view_url = reverse('input_stock', kwargs={
        'domain': TEST_DOMAIN,
        'site_code': 'tsactive',
    })
    data = {
        'form-TOTAL_FORMS': 2,
        'form-INITIAL_FORMS': 2,
        'form-MAX_NUM_FORMS': 1000,
    }
    tsactive = SQLLocation.objects.get(domain=TEST_DOMAIN, site_code='tsactive')
    data['form-0-product_id'] = self.ad.product_id
    data['form-0-product'] = 'ad'
    data['form-0-stock_on_hand'] = ''
    data['form-0-receipts'] = ''
    data['form-1-product_id'] = self.al.product_id
    url['form-1-product'] = 'al'
    data['form-1-stock_on_hand'] = 14
    data['form-1-receipts'] = 17
    response = self.client.post(view_url, data=data)
    url = make_url(StockStatus, self.domain, '?location_id=%s&filter_by_program=all&startdate=&enddate=&report_type=&filter_by_product=all', (tsactive.location_id,))
    self.assertRedirects(response, url)
    stock_states = StockState.objects.filter(case_id=tsactive.supply_point_id)
    stock_transactions = StockTransaction.objects.filter(case_id=tsactive.supply_point_id)
    self.assertEqual(stock_states.count(), 1)
    self.assertEqual(stock_transactions.count(), 3)
    ad_transactions = stock_transactions.filter(product_id=self.ad.product_id)
    self.assertEqual(ad_transactions.count(), 0)
    with self.assertRaises(StockState.DoesNotExist):
        StockState.objects.get(case_id=tsactive.supply_point_id, product_id=self.ad.product_id)

dataset/ETHPy150Open dimagi/commcare-hq/custom/ewsghana/tests/test_input_stock_view.py TestInputStockView.test_incomplete_report_submission/VarMisuse@133/230 `data`->`url`