forked from AAYBS/jn-upwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# 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
1 parent
e4ff15b
commit 0ea15e3
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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?/") |
0ea15e3
There was a problem hiding this comment.
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.