def test_legacy_keywords(migration): app = 'company' model_name = 'Company' name = '0044_rebuild_elasticserach_index' migration.before(app, name).get_model(app, model_name) company_one = CompanyFactory.create(keywords='hello, test, foo') company_two = CompanyFactory.create(keywords='hello; test: foo') company_three = CompanyFactory.create(keywords='hello\t test\t foo') migration.apply('company', '0045_auto_20170620_1426') for company in [company_one, company_two, company_three]: company.refresh_from_db() assert company_two.keywords == 'hello, test, foo' assert company_three.keywords == 'hello, test, foo'
def test_supplier_with_company_serializer_save(): company = CompanyFactory.create(number='01234567') data = VALID_REQUEST_DATA.copy() data['company'] = company.pk serializer = serializers.SupplierSerializer(data=data) serializer.is_valid() supplier = serializer.save() assert supplier.company == company