Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
36aa069f
Commit
36aa069f
authored
Nov 25, 2014
by
Roman Inflianskas
Committed by
Bruno Pinto
Nov 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dpaste] Add system tests
parent
e957365d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
plugins/dpaste/tests/test_dpaste.fish
plugins/dpaste/tests/test_dpaste.fish
+76
-0
No files found.
plugins/dpaste/tests/test_dpaste.fish
View file @
36aa069f
#!/usr/bin/env fish
#!/usr/bin/env fish
# vim: ai ts=2 sw=2 et sts=2
function echo_text
set -g __test_text 'Hello, tests! I am just testing suite for oh-my-fish plugin: https://github.com/bpinto/oh-my-fish/pull/170'
echo -e $__test_text
end
function curl
command curl --silent $argv
end
function curl_and_check
assert_equal $argv[2..-1] (curl $argv[1])
end
function curl_and_fail
assert_match '.*404 Not found.*' (curl $argv[1])
end
function test_dpaste_system
set url (eval $argv[1])/raw
# everything is correct:
# one time snippets are available twice if you use curl
curl_and_check $url (echo_text)
curl_and_check $url (echo_text)
# now it shouldn't be available
curl_and_fail $url
end
function dpaste_setup
set -g test_dir /tmp/dpaste_test
set -g test_file $test_dir/file
mkdir -p $test_dir
pushd
cd $test_dir
echo_text > $test_file
end
function dpaste_teardown
rm -rf $test_dir
popd
end
function suite_dpaste
function suite_dpaste
function setup
function setup
...
@@ -16,11 +59,44 @@ function suite_dpaste
...
@@ -16,11 +59,44 @@ function suite_dpaste
assert_equal "https://dpaste.de/api/?format=url&expires=3600" $__dpaste_send_url
assert_equal "https://dpaste.de/api/?format=url&expires=3600" $__dpaste_send_url
set -g __dpaste_send_url $dpaste_url
set -g __dpaste_send_url $dpaste_url
end
end
function test_dpaste_system_file_redirect
function dpaste_file_redirect
dpaste -t onetime < /tmp/dpaste_test/file
end
test_dpaste_system dpaste_file_redirect
end
function test_dpaste_system_file
function dpaste_file
dpaste -t onetime /tmp/dpaste_test/file
end
test_dpaste_system dpaste_file
end
function test_dpaste_system_stdin
function dpaste_stdin
echo_text | dpaste -t onetime
end
test_dpaste_system dpaste_stdin
end
function test_dpaste_system_text
function dpaste_text
dpaste -t onetime "$__test_text"
end
test_dpaste_system dpaste_text
end
end
end
if not set -q tank_running
if not set -q tank_running
source (dirname (status -f))/helper.fish
source (dirname (status -f))/helper.fish
set -g __dpaste_expires_choises
set -g __dpaste_expires_choises
source (dirname (status -f))/../dpaste.fish
source (dirname (status -f))/../dpaste.fish
dpaste_setup
tank_run
tank_run
dpaste_teardown
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment