def set_test_jobs(self):
     unchanged = Job(
         url="https://www.freelance.nl/opdracht/900882-bi-sas-specialist",
         title="BI/SAS specialist",
         location="Apeldoorn",
         posted_on=datetime.now(),
         applications=0)
     changed = Job(
         url="https://www.freelance.nl/opdracht/900815-aws-machine-learning",
         title="AWS Machine Learning ",
         location="Remote/Amsterdam",
         posted_on=datetime.now(),
         applications=0)
     default.extra_jobs += [unchanged, changed]
Beispiel #2
0
def add_job(job: job_schemas.JobCreate,
            session: Session = Depends(get_session)):
    """Add a new jobs and returns id"""

    new_job = Job(**job.dict())
    # I far from like passing down dependencies manually and creating
    # unnecessary coupling.
    return Repository.add_job(new_job, session)
Beispiel #3
0
def jobs() -> List[Job]:
    return [
        Job(
            title="Developer",
            url="https://www.dream.jobs/1",
            location="Amsterdam",
            posted_on=datetime.now()),
        Job(
            title="Tester",
            url="https://www.dream.jobs/2",
            location="Rotterdam",
            posted_on=datetime.now() - timedelta(days=2)),
        Job(
            title="DevOps Engineer",
            url="https://www.dream.jobs/3",
            location="Utrecht",
            posted_on=datetime.now() - timedelta(days=1)),
    ] + extra_jobs
    def test_has_changed(self, field, new_value):
        fields = vars(self.original)

        job_fields = {
            k: v
            for (k, v) in fields.items() if not k.startswith('_')
        }
        job_fields[field] = new_value
        changed: Job = Job(**job_fields)

        assert changed.has_changed(self.original)
    def parse_job(self, a_tag):
        url = a_tag['href']
        title_tag = a_tag.find_next("span", {"class": "title"})
        location = title_tag.find_next_sibling("span", {
            "class": "location"
        }).text
        applications = title_tag.find_next_sibling("span", {
            "class": "applications"
        }).text
        date = self.parse_date(
            title_tag.find_next_sibling("span", {
                "class": "date"
            }).text)
        # can_read = 'pro' not in a_tag.parent.parent['class']

        return Job(url=url,
                   title=title_tag.text,
                   location=location,
                   applications=int(applications),
                   posted_on=date)
 def setUp(self) -> None:
     self.original: Job = Job(url="https://my.dream.job/123",
                              title="My dream job",
                              location="Amsterdam",
                              applications=10,
                              posted_on=datetime.now())
 def test_should_raise_different_urls(self):
     with self.assertRaises(ValueError):
         other = Job(url="https://notmy.dream.job/0")
         self.original.has_changed(other)