Repository navigation
Create, show, update and delete timesheet entries #982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
97cd27f
Create, show, update and delete timesheet entries
jeremy 8c2ad45
Hold a pasted timesheet URL to its host and account
jeremy 26bc68b
Give machine readers a runnable timesheet delete, and a serial smoke …
jeremy c7cba82
Take only an id or a trusted item URL for timesheet entries
jeremy badc84c
Match a timesheet URL's parsed path, not its raw text
jeremy 87ddf41
Name whose time a timesheet entry is in its summary
jeremy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,57 @@ | ||
| #!/usr/bin/env bats | ||
| # smoke_timesheet_write.bats - Level 1: Timesheet entry lifecycle on a to-do | ||
|
|
||
| load smoke_helper | ||
|
|
||
| setup_file() { | ||
| # Each test depends on the one before it: create writes the entry id the | ||
| # rest read, and delete must come last. | ||
| export BATS_NO_PARALLELIZE_WITHIN_FILE=true | ||
| ensure_token || return 1 | ||
| ensure_todo || return 1 | ||
| } | ||
|
|
||
| @test "timesheet entry create logs time against a todo" { | ||
| run_smoke basecamp timesheet entry create "$QA_TODO" --hours 0.25 --description "Smoke entry $(date +%s)" --json | ||
| # Timesheets may not be enabled on all accounts (403 forbidden) | ||
| [[ "$status" -eq 4 ]] && mark_unverifiable "Timesheets not enabled in this account" | ||
| assert_success | ||
| assert_json_value '.ok' 'true' | ||
| assert_json_not_null '.data.id' | ||
|
|
||
| echo "$output" | jq -r '.data.id' > "$BATS_FILE_TMPDIR/timesheet_entry_id" | ||
| } | ||
|
|
||
| @test "timesheet entry show returns entry detail" { | ||
| local id_file="$BATS_FILE_TMPDIR/timesheet_entry_id" | ||
| [[ -f "$id_file" ]] || mark_unverifiable "No timesheet entry created in prior test" | ||
|
jeremy marked this conversation as resolved.
Resolved
|
||
| local entry_id | ||
| entry_id=$(<"$id_file") | ||
|
|
||
| run_smoke basecamp timesheet entry show "$entry_id" --json | ||
| assert_success | ||
| assert_json_value '.ok' 'true' | ||
| assert_json_value '.data.parent.id' "$QA_TODO" | ||
| } | ||
|
|
||
| @test "timesheet entry update changes the hours" { | ||
| local id_file="$BATS_FILE_TMPDIR/timesheet_entry_id" | ||
| [[ -f "$id_file" ]] || mark_unverifiable "No timesheet entry created in prior test" | ||
| local entry_id | ||
| entry_id=$(<"$id_file") | ||
|
|
||
| run_smoke basecamp timesheet entry update "$entry_id" --hours 0:30 --json | ||
| assert_success | ||
| assert_json_value '.ok' 'true' | ||
| } | ||
|
|
||
| @test "timesheet entry delete removes the entry" { | ||
| local id_file="$BATS_FILE_TMPDIR/timesheet_entry_id" | ||
| [[ -f "$id_file" ]] || mark_unverifiable "No timesheet entry created in prior test" | ||
| local entry_id | ||
| entry_id=$(<"$id_file") | ||
|
|
||
| run_smoke basecamp timesheet entry delete "$entry_id" --force --json | ||
| assert_success | ||
| assert_json_value '.data.deleted' 'true' | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.