Beispiel #1
0
    def test_enable_posting(self):
        """
        Attempting to automatically enable posting for a company should result
        in a valid site package owned by that company.

        """
        AppAccessFactory(name='Posting')
        company = CompanyFactory(name='Posting Company')
        site = SeoSite.objects.create(domain='somewhere.jobs')
        # sanity checks
        self.assertIsNone(site.canonical_company)
        self.assertEqual(company.enabled_access, [])

        package = enable_posting(company, site)

        # Django caches model instances
        company = Company.objects.get(pk=company.pk)
        site = SeoSite.objects.get(pk=site.pk)

        self.assertEqual(site.canonical_company, company)
        self.assertIn("Posting", company.enabled_access)
        self.assertIn(site, package.sites.all())
        self.assertTrue(
            LoginBlock.objects.filter(
                name="Posting Company Login Block").exists())
Beispiel #2
0
def enable_feature(request, feature):
    ctx = {'feature': feature}
    if request.method == "POST":
        form = MarketPlaceEnableForm(request.POST)

        if form.is_valid():
            company = form.cleaned_data['company']
            site = form.cleaned_data['site']
            if feature == 'Posting':
                enable_posting(company, site)
            elif feature == 'MarketPlace':
                enable_marketplace(company, site)
            ctx['message'] = 'Success'
    else:
        form = MarketPlaceEnableForm()
    ctx['form'] = form

    return render_to_response('postajob/enable_feature.html', ctx,
                              RequestContext(request))
Beispiel #3
0
def enable_feature(request, feature):
    ctx = {'feature': feature}
    if request.method == "POST":
        form = MarketPlaceEnableForm(request.POST)

        if form.is_valid():
            company = form.cleaned_data['company']
            site = form.cleaned_data['site']
            if feature == 'Posting':
                enable_posting(company, site)
            elif feature == 'MarketPlace':
                enable_marketplace(company, site)
            ctx['message'] = 'Success'
    else:
        form = MarketPlaceEnableForm()
    ctx['form'] = form

    return render_to_response(
        'postajob/enable_feature.html', ctx, RequestContext(request))
Beispiel #4
0
    def test_enable_posting(self):
        """
        Attempting to automatically enable posting for a company should result
        in a valid site package owned by that company.

        """
        AppAccessFactory(name='Posting')
        company = CompanyFactory(name='Posting Company')
        site = SeoSite.objects.create(domain='somewhere.jobs')
        # sanity checks
        self.assertIsNone(site.canonical_company)
        self.assertEqual(company.enabled_access, [])

        package = enable_posting(company, site)

        # Django caches model instances
        company = Company.objects.get(pk=company.pk)
        site = SeoSite.objects.get(pk=site.pk)

        self.assertEqual(site.canonical_company, company)
        self.assertIn("Posting", company.enabled_access)
        self.assertIn(site, package.sites.all())
        self.assertTrue(LoginBlock.objects.filter(
            name="Posting Company Login Block").exists())