Ejemplo n.º 1
0
    def setUp(self):
        super(SavedSearchHelperTests, self).setUp()
        self.user = UserFactory()
        self.valid_url = 'http://www.my.jobs/jobs?location=chicago&q=nurse'

        self.patcher = patch('urllib2.urlopen', return_file())
        self.patcher.start()
Ejemplo n.º 2
0
    def setUp(self):
        super(SavedSearchFormTests, self).setUp()
        self.user = UserFactory()
        self.data = {'url': 'http://www.my.jobs/jobs',
                     'feed': 'http://www.my.jobs/jobs/feed/rss?',
                     'email': self.user.email,
                     'frequency': 'D',
                     'jobs_per_email': 5,
                     'label': 'All jobs from www.my.jobs',
                     'sort_by': 'Relevance'}

        self.patcher = patch('urllib2.urlopen', return_file())
        self.patcher.start()
Ejemplo n.º 3
0
    def setUp(self):
        super(SavedSearchResourceTests, self).setUp()
        self.user = UserFactory()
        self.client = TestClient(
            path='/api/v1/savedsearch/',
            data={'email': '*****@*****.**',
                  'url': 'www.my.jobs/jobs'})
        create_api_key(User, instance=self.user, created=True)

        self.credentials = (self.user.email, self.user.api_key.key)

        self.patcher = patch('urllib2.urlopen', return_file())
        self.patcher.start()
Ejemplo n.º 4
0
    def setUp(self):
        super(PartnerSavedSearchFormTests, self).setUp()
        self.user = UserFactory()
        self.company = CompanyFactory()
        self.partner = PartnerFactory(owner=self.company)

        self.contact = ContactFactory(user=None, email='*****@*****.**',
                                      partner=self.partner)
        self.partner_search_data = {
            'url': 'http://www.my.jobs/jobs',
            'feed': 'http://www.my.jobs/jobs/feed/rss?',
            'frequency': 'D',
            'label': 'All jobs from www.my.jobs',
            'sort_by': 'Relevance',
            'jobs_per_email': 5,
            'email': self.contact.email,
        }

        settings.SITE = SeoSite.objects.first()
        # This request is only used in RequestForms, where all we care about
        # is request.user.
        self.request = RequestFactory().get(
            reverse('partner_savedsearch_save'))
        self.request.user = self.user

        form = PartnerSavedSearchForm(partner=self.partner,
                                      data=self.partner_search_data,
                                      request=self.request)
        instance = form.instance
        instance.provider = self.company
        instance.partner = self.partner
        instance.created_by = self.user
        instance.custom_message = instance.partner_message
        self.assertTrue(form.is_valid())
        form.save()

        self.patcher = patch('urllib2.urlopen', return_file())
        self.mock_urlopen = self.patcher.start()