def test_multiple_company(self, mock_tool): mock_tool.return_value = [ self._get_mock(), self._get_mock(), ] data = {'is_krs' : '1', 'no': 123} form = CompanyCreateFromKRSForm(data=data) self.assertFalse(form.is_valid())
def test_success_by_nip(self, mock_tool): mock_tool.return_value = [self._get_mock()] data = {'is_krs' : '0', 'no': 123} form = CompanyCreateFromKRSForm(data=data) self.assertTrue(form.is_valid())
def test_no_company_in_remote_api(self, mock_tool): mock_tool.return_value = [] data = {'is_krs' : '1', 'no': 123} form = CompanyCreateFromKRSForm(data=data) self.assertFalse(form.is_valid())
def test_existings_compnay_in_db(self, mock_tool): CompanyFactory(nip=123) mock_tool.return_value = [self._get_mock()] data = {'is_krs' : '1', 'no': 123} form = CompanyCreateFromKRSForm(data=data) self.assertFalse(form.is_valid())