

def test_web_user_with_valid_parent_location_access(self):
    self.client.login(username=self.username5, password=self.password5)
    view_url = reverse('input_stock', kwargs={
        'domain': TEST_DOMAIN,
        'site_code': 'tsactive',
    })
    response = self.client.get(view_url, follow=True)
    self.assertEqual(response.status_code, 200)
    formset = response.context['formset']
    tsactive = SQLLocation.objects.get(domain=TEST_DOMAIN, site_code='tsactive')
    self.assertIsNotNone(formset)
    self.assertEqual(tsactive.products.count(), 2)
    self.assertEqual(len(list(formset)), tsactive.products.count())

dataset/ETHPy150Open dimagi/commcare-hq/custom/ewsghana/tests/test_input_stock_view.py TestInputStockView.test_web_user_with_valid_parent_location_access/original