Repository navigation
Add pings commands: list, show, start, messages, post, upload #913
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
7 commits
Select commit
Hold shift + click to select a range
6c80306
Build against SDK v0.26.0
robzolkos dc543f5
Parse Ping URLs
robzolkos b8f06ee
List a person's pings in the TUI from the Pings API
robzolkos 8938497
Add the pings commands
robzolkos bcb83ea
Accept the sidebar form of a ping URL
robzolkos 530c8a0
Answer the review of the pings commands
robzolkos 0f177dc
Mention only a Ping's people when editing its line
robzolkos 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,71 @@ | ||
| #!/usr/bin/env bats | ||
| # pings.bats - Test pings command input handling | ||
|
|
||
| load test_helper | ||
|
|
||
|
|
||
| # Help | ||
|
|
||
| @test "pings without subcommand shows help" { | ||
| run basecamp pings | ||
| assert_success | ||
| assert_output_contains "COMMANDS" | ||
| assert_output_contains "start" | ||
| } | ||
|
|
||
| @test "ping is an alias of pings" { | ||
| run basecamp ping | ||
| assert_success | ||
| assert_output_contains "COMMANDS" | ||
| } | ||
|
|
||
| @test "pings list help says when a ping appears" { | ||
| run basecamp pings list --help | ||
| assert_success | ||
| assert_output_contains "once someone has posted" | ||
| } | ||
|
|
||
| @test "chat list help points to pings" { | ||
| run basecamp chat list --help | ||
| assert_success | ||
| assert_output_contains "basecamp pings list" | ||
| } | ||
|
|
||
|
|
||
| # Input errors that need no network | ||
|
|
||
| @test "pings start --new-group needs two people" { | ||
| create_credentials | ||
| create_global_config '{"account_id": 99999}' | ||
|
|
||
| run basecamp pings start Jane --new-group | ||
| assert_failure | ||
| assert_output_contains "--new-group needs two or more people" | ||
| } | ||
|
|
||
| @test "pings show rejects a URL that is not a ping" { | ||
| create_credentials | ||
| create_global_config '{"account_id": 99999}' | ||
|
|
||
| run basecamp pings show https://3.basecamp.com/99999/buckets/1/todos/2 | ||
| assert_failure | ||
| assert_output_contains "expected a ping URL" | ||
| } | ||
|
|
||
| @test "pings show rejects a URL on an untrusted host" { | ||
| create_credentials | ||
| create_global_config '{"account_id": 99999}' | ||
|
|
||
| run basecamp pings show https://evil.example.com/99999/circles/1 | ||
| assert_failure | ||
| assert_output_contains "untrusted host" | ||
| } | ||
|
|
||
| @test "pings messages --limit without value shows error" { | ||
| create_credentials | ||
| create_global_config '{"account_id": 99999}' | ||
|
|
||
| run basecamp pings messages 1 --limit | ||
| assert_failure | ||
| assert_output_contains "--limit requires a value" | ||
| } |
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,51 @@ | ||
| #!/usr/bin/env bats | ||
| # smoke_pings.bats - Level 0: Pings (private conversations) | ||
|
|
||
| load smoke_helper | ||
|
|
||
| setup_file() { | ||
| ensure_token || return 1 | ||
| } | ||
|
|
||
| @test "pings list returns pings" { | ||
| run_smoke basecamp pings list --json | ||
| assert_success | ||
| assert_json_value '.ok' 'true' | ||
|
|
||
| echo "$output" | jq -r '.data[0].id // empty' > "$BATS_FILE_TMPDIR/ping_id" | ||
| } | ||
|
|
||
| @test "pings show returns a ping" { | ||
| local id_file="$BATS_FILE_TMPDIR/ping_id" | ||
| [[ -s "$id_file" ]] || mark_unverifiable "No pings to show" | ||
| local ping_id | ||
| ping_id=$(<"$id_file") | ||
|
|
||
| run_smoke basecamp pings show "$ping_id" --json | ||
| assert_success | ||
| assert_json_value '.ok' 'true' | ||
| assert_json_not_null '.data.campfire_id' | ||
| } | ||
|
|
||
| @test "pings messages returns lines" { | ||
| local id_file="$BATS_FILE_TMPDIR/ping_id" | ||
| [[ -s "$id_file" ]] || mark_unverifiable "No pings to read" | ||
| local ping_id | ||
| ping_id=$(<"$id_file") | ||
|
|
||
| run_smoke basecamp pings messages "$ping_id" --limit 1 --json | ||
| assert_success | ||
| assert_json_value '.ok' 'true' | ||
| } | ||
|
|
||
| @test "pings start is out of scope" { | ||
| mark_out_of_scope "Mutating - opens or creates a ping with a real person; covered by the live round-trip" | ||
| } | ||
|
|
||
| @test "pings post is out of scope" { | ||
| mark_out_of_scope "Mutating - posts into a private conversation with a real person; covered by the live round-trip" | ||
| } | ||
|
|
||
| @test "pings upload is out of scope" { | ||
| mark_out_of_scope "Mutating - uploads into a private conversation with a real person; covered by the live round-trip" | ||
| } |
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
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.