-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed TimeEntryAPI class which makes list_time_entries work without ticket id. Also removed unrelated get_role method. * Using .format for URL to be consistent * Renamed time_entry API property to time_entries to be consistent * Updated time entry model to be in sync with comments * Added tests for time entries Co-authored-by: Csaba Major <csaba.major@commsignia.com>
- Loading branch information
Showing
6 changed files
with
153 additions
and
12 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
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
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
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 @@ | ||
[ | ||
{ | ||
"billable": true, | ||
"note": "This is the first entry", | ||
"id": 1, | ||
"timer_running": false, | ||
"agent_id": 1, | ||
"ticket_id": 1, | ||
"company_id": 2, | ||
"time_spent": "00:15", | ||
"executed_at": "2020-09-27T22:00:00Z", | ||
"start_time": "2020-09-28T12:14:00Z", | ||
"created_at": "2020-09-28T12:14:00Z", | ||
"updated_at": "2020-09-28T12:14:00Z" | ||
}, | ||
{ | ||
"billable": true, | ||
"note": "This is the second entry", | ||
"id": 2, | ||
"timer_running": false, | ||
"agent_id": 1, | ||
"ticket_id": 2, | ||
"company_id": 2, | ||
"time_spent": "00:10", | ||
"executed_at": "2020-09-24T22:00:00Z", | ||
"start_time": "2020-09-25T07:44:32Z", | ||
"created_at": "2020-09-25T07:44:32Z", | ||
"updated_at": "2020-09-25T07:44:32Z" | ||
}, | ||
{ | ||
"billable": true, | ||
"note": "", | ||
"id": 3, | ||
"timer_running": false, | ||
"agent_id": 1, | ||
"ticket_id": 3, | ||
"company_id": 2, | ||
"time_spent": "00:15", | ||
"executed_at": "2020-09-23T22:00:00Z", | ||
"start_time": "2020-09-24T10:25:05Z", | ||
"created_at": "2020-09-24T10:25:05Z", | ||
"updated_at": "2020-09-24T10:25:05Z" | ||
} | ||
] |
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 @@ | ||
[ | ||
{ | ||
"billable": true, | ||
"note": "This is test time entry", | ||
"id": 1, | ||
"timer_running": false, | ||
"agent_id": 2, | ||
"ticket_id": 521, | ||
"company_id": 3, | ||
"time_spent": "00:10", | ||
"executed_at": "2020-09-27T22:00:00Z", | ||
"start_time": "2020-09-28T12:14:00Z", | ||
"created_at": "2020-09-28T12:14:00Z", | ||
"updated_at": "2020-09-28T12:14:00Z" | ||
}, | ||
{ | ||
"billable": true, | ||
"note": "", | ||
"id": 2, | ||
"timer_running": false, | ||
"agent_id": 2, | ||
"ticket_id": 521, | ||
"company_id": 3, | ||
"time_spent": "00:10", | ||
"executed_at": "2020-09-24T22:00:00Z", | ||
"start_time": "2020-09-25T07:44:32Z", | ||
"created_at": "2020-09-25T07:44:32Z", | ||
"updated_at": "2020-09-25T07:44:32Z" | ||
}, | ||
{ | ||
"billable": true, | ||
"note": "", | ||
"id": 3, | ||
"timer_running": false, | ||
"agent_id": 2, | ||
"ticket_id": 521, | ||
"company_id": 3, | ||
"time_spent": "00:15", | ||
"executed_at": "2020-09-23T22:00:00Z", | ||
"start_time": "2020-09-24T10:25:05Z", | ||
"created_at": "2020-09-24T10:25:05Z", | ||
"updated_at": "2020-09-24T10:25:05Z" | ||
} | ||
] |
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,41 @@ | ||
import pytest | ||
|
||
from freshdesk.v2.models import TimeEntry | ||
|
||
|
||
@pytest.fixture | ||
def time_entries_1(api): | ||
return api.time_entries.list_time_entries(1) | ||
|
||
@pytest.fixture | ||
def time_entries_all(api): | ||
return api.time_entries.list_time_entries() | ||
|
||
|
||
def test_time_entries_1_list(time_entries_1): | ||
assert isinstance(time_entries_1, list) | ||
assert len(time_entries_1) == 3 | ||
assert isinstance(time_entries_1[0], TimeEntry) | ||
|
||
|
||
def test_time_entries_all_list(time_entries_all): | ||
assert isinstance(time_entries_all, list) | ||
assert len(time_entries_all) == 3 | ||
assert isinstance(time_entries_all[0], TimeEntry) | ||
|
||
|
||
def test_time_entries_1_str(time_entries_1): | ||
assert str(time_entries_1[0]) == "This is test time entry (00:10)" | ||
|
||
|
||
def test_time_entries_all_str(time_entries_all): | ||
assert str(time_entries_all[0]) == "This is the first entry (00:15)" | ||
|
||
|
||
def test_time_entries_1_repr(time_entries_1): | ||
assert repr(time_entries_1[0]) == "<Timesheet entry for Ticket #521>" | ||
|
||
|
||
def test_time_entries_all_repr(time_entries_all): | ||
assert repr(time_entries_all[0]) == "<Timesheet entry for Ticket #1>" | ||
|