Skip to content

Commit

Permalink
WIP: Adding testing
Browse files Browse the repository at this point in the history
# Why # 

_This is part of my Hacktoberfest effort_
Response to issue AAYBS#4

# How # 

Adding trivial tests for now.

# Comments # 

Still need to find a good test expectation for `test_search_jobs`
  • Loading branch information
bertilhatt authored Oct 16, 2018
1 parent e4ff15b commit 0ea15e3
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions upwork/test_notification.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import datetime as dt
import unittest
import configparser
from upwork.notifications import Job
from upwork.notifications import UpworkClient


class TestJob(unittest.TestCase):

def setUp(self):
self.job = Job(
"Expert", dt.date(2001, 1, 1), "developers", "…",
"Lead Android Developer",
"https://www.upwork.com/job/Lead-Android-Developer-Full-Time_~01f6da1b38a626ea53/",
)

def test_init(self):
self.assertEqual(self.job.budget, "Expert")
self.assertEqual(self.job.date, dt.date(2001, 1, 1))

def test_jobinfo(self):
self.assertEqual(self.job.jobinfo(),
"New job: Lead Android Developer \nType: developers" +\
"\nBudget : Expert $ \nCreated on: 2001-01-01 " +\
"Informations: … \nLink: https://www.upwork.com/job/Lead-Android-Developer-Full-Time_~01f6da1b38a626ea53/"
)


class TestUpworkClient(unittest.TestCase):

api_key = config['uwpork']['api_key']
api_secret = config['uwpork']['api_key']
job_skill = config['upwork']['job_skill']
job_query = dict(
skills=[job_skill],
budget='[100 TO 100000]',
duration=['week', 'month', 'ongoing']
)

def setUp(self):
self.upworkclient = UpworkClient(api_key, api_secret)

def test_search_jobs(self):
self.assertEqual(self.upworkclient.search_jobs(job_query), "/Need to fill in here: Does Upwork has a live test job?/")

1 comment on commit 0ea15e3

@bertilhatt
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s dawning on me that this would be better handled by mocking the API.

Stuff at work, but I’ll try to make progress this week-end.

Please sign in to comment.