def test_delete_unpublished_fab_company_from_elasticsearch(): company = factories.CompanyFactory(is_published_find_a_supplier=False) company_pk = company.pk company.delete() with pytest.raises(elasticsearch.exceptions.NotFoundError): CompanyDocument.get(id=company_pk)
def test_delete_unpublish_isd_company_from_elasticsearch(): company = factories.CompanyFactory(is_published_find_a_supplier=True) company_pk = company.pk CompanyDocument.get(id=company_pk) # not raises if exists company.is_published_find_a_supplier = False company.save() with pytest.raises(elasticsearch.exceptions.NotFoundError): CompanyDocument.get(id=company_pk)
def test_elasticsearch_migrate_turned_off(settings): settings.FEATURE_FLAG_ELASTICSEARCH_REBUILD_INDEX = False published_company = factories.CompanyFactory( is_published_find_a_supplier=True) published_investment_support_directory = factories.CompanyFactory( is_published_investment_support_directory=True, ) CompanyDocument.get(id=published_company.pk, ignore=404).delete() CompanyDocument.get(id=published_investment_support_directory.pk, ignore=404).delete() management.call_command('elasticsearch_migrate') assert CompanyDocument.get(id=published_investment_support_directory.pk, ignore=404) is None assert CompanyDocument.get(id=published_company.pk, ignore=404) is None