def setUp(self): super(QuerysetCopierTests, self).setUp() self.copy_to = factories.copy_to_database # Using SeoSite for the object being copied because it covers # most types of recursive relationships, foreign keys and # many to many relationships. self.seosite = factories.SeoSiteFactory() # copy_objects() expects a queryset self.seosites = models.SeoSite.objects.filter(pk=self.seosite.pk) # Many-to-manys tag = models.SiteTag.objects.create(site_tag='Copy Test') self.seosite.site_tags.add(tag) tag = models.SiteTag.objects.create(site_tag='Copy Test 2') self.seosite.site_tags.add(tag) buid = factories.BusinessUnitFactory(pk=123321) self.seosite.business_units.add(buid) company = factories.CompanyFactory() self.seosite.featured_companies.add(company) # Nullable Foreign Keys self.seosite.canonical_company = company self.seosite.save() self.site_foreign_key_field_names = ['site_ptr'] self.site_null_foreign_key_field_names = ['group', 'canonical_company'] self.site_many_to_many_field_names = ['site_tags', 'business_units', 'featured_companies']
def setUp(self): super(TestRoles, self).setUp() self.user = factories.UserFactory() self.business_unit = factories.BusinessUnitFactory() self.company = factories.CompanyFactory() self.company.job_source_ids.add(self.business_unit) self.site = factories.SeoSiteFactory() self.site.business_units.add(self.business_unit)
def setUp(self): super(SiteTestCase, self).setUp() self.conn = Solr('http://127.0.0.1:8983/solr/seo') self.conn.delete(q="*:*") self.businessunit = factories.BusinessUnitFactory(id=0) self.buid = self.businessunit.id self.filepath = os.path.join(import_jobs.DATA_DIR, 'dseo_feed_%s.xml' % self.buid) SeoSite.objects.all().delete() self.site = factories.SeoSiteFactory(id=1) self.configuration = factories.ConfigurationFactory(status=2) self.configuration.save() self.site.configurations.clear() self.site.configurations.add(self.configuration)
def setUp(self): super(SeoSitePostAJobFiltersTestCase, self).setUp() self.company = factories.CompanyFactory() self.company_buid = factories.BusinessUnitFactory() self.company.job_source_ids.add(self.company_buid)