You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. #!/bin/bash
  2. set -e
  3. source $(dirname $0)/helpers.sh
  4. # set FILE_URL_WITH_LAST_MODIFIED_INFO with a URL of a file whose HTTP HEADER info provides a Last-Modified entry
  5. # to check it do "curl -I -R <url>"
  6. export FILE_URL_WITH_LAST_MODIFIED_INFO=https://s3-us-west-1.amazonaws.com/lsilva-bpws/PCF_usage/pcf-sandbox-usage-from-2016-09-01-to-2016-09-30_1475771124.json
  7. # set FILE_URL_WITHOUT_LAST_MODIFIED_INFO with a URL of a file whose HTTP HEADER info DOES NOT provide a Last-Modified entry
  8. # to check it do "curl -I -R <url>"
  9. export FILE_URL_WITHOUT_LAST_MODIFIED_INFO=https://raw.githubusercontent.com/pivotalservices/concourse-curl-resource/master/test/data/pivotal-1.0.0.txt
  10. # set FILE_URL_WITHOUT_LAST_MODIFIED_INFO with a URL of a file whose HTTP HEADER info DOES NOT provide a Last-Modified entry
  11. # to check it do "curl -I -R <url>"
  12. export FILE_URL_BASIC_AUTH=https://auth-demo.aerobatic.io/protected-standard
  13. it_can_get_file_with_last_modified_info() {
  14. echo $resource_dir
  15. jq -n "{
  16. source: {
  17. url: $(echo $FILE_URL_WITH_LAST_MODIFIED_INFO | jq -R .)
  18. }
  19. }" | $resource_dir/check "$FILE_URL_WITH_LAST_MODIFIED_INFO" | tee /dev/stderr
  20. }
  21. it_can_get_file_without_last_modified_info() {
  22. jq -n "{
  23. source: {
  24. url: $(echo $FILE_URL_WITHOUT_LAST_MODIFIED_INFO | jq -R .)
  25. }
  26. }" | $resource_dir/check "$FILE_URL_WITHOUT_LAST_MODIFIED_INFO" | tee /dev/stderr
  27. }
  28. it_can_get_file_with_basic_auth() {
  29. echo $resource_dir
  30. jq -n "{
  31. source: {
  32. url: $(echo $FILE_URL_BASIC_AUTH | jq -R .),
  33. username: $(echo 'aerobatic' | jq -R .),
  34. password: $(echo 'aerobatic' | jq -R .),
  35. filename: $(echo 'basicauth.txt' | jq -R .)
  36. }
  37. }" | $resource_dir/check "$FILE_URL_BASIC_AUTH" | tee /dev/stderr
  38. }
  39. run it_can_get_file_with_last_modified_info
  40. run it_can_get_file_without_last_modified_info
  41. run it_can_get_file_with_basic_auth