PageRenderTime 55ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/test/test_stash-git.rb

https://bitbucket.org/atlassian/stash-command-line-tools
Ruby | 57 lines | 51 code | 6 blank | 0 comment | 0 complexity | 05ac5965923904ebb181cb54d0198a27 MD5 | raw file
  1. require 'helper'
  2. include Atlassian::Stash
  3. include Atlassian::Stash::Git
  4. class TestGit < Test::Unit::TestCase
  5. should "extract remote with ssh remote" do
  6. Atlassian::Stash::Git.instance_eval do
  7. def get_remotes
  8. "origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (fetch)
  9. origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (push)"
  10. end
  11. end
  12. assert_equal 'ssh://git@stash.atlassian.com:7999/STASH/stash.git', Atlassian::Stash::Git.get_remote_url
  13. end
  14. should "extract push remote with different fetch and push urls" do
  15. Atlassian::Stash::Git.instance_eval do
  16. def get_remotes
  17. "origin ssh://git@github.com/~sebr/stash.git (fetch)
  18. origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (push)"
  19. end
  20. end
  21. assert_equal 'ssh://git@stash.atlassian.com:7999/STASH/stash.git', Atlassian::Stash::Git.get_remote_url
  22. end
  23. should "extract remote with http remote" do
  24. Atlassian::Stash::Git.instance_eval do
  25. def get_remotes
  26. "origin http://adam@sonoma:7990/stash/scm/QA/stash.git (fetch)
  27. origin http://adam@sonoma:7990/stash/scm/QA/stash.git (push)"
  28. end
  29. end
  30. assert_equal 'http://adam@sonoma:7990/stash/scm/QA/stash.git', Atlassian::Stash::Git.get_remote_url
  31. end
  32. should "extract remote with multiple remote urls" do
  33. Atlassian::Stash::Git.instance_eval do
  34. def get_remotes
  35. "bitbucket git@bitbucket.org:atlassian/stash-command-line-tools.git (fetch)
  36. bitbucket git@bitbucket.org:atlassian/stash-command-line-tools.git (push)
  37. kostya http://admin@kostya:7990/scm/CA/cylon.git (fetch)
  38. kostya http://admin@kostya:7990/scm/CA/cylon.git (push)
  39. local http://delirium:7990/git/STASH/stash.git (fetch)
  40. local http://delirium:7990/git/STASH/stash.git (push)
  41. origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (fetch)
  42. origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (push)
  43. seb http://adam@sonoma:7990/stash/scm/QA/stash.git (fetch)
  44. seb http://adam@sonoma:7990/stash/scm/QA/stash.git (push)
  45. upstream http://github-enterprise-11-10/stash/stash.git (fetch)
  46. upstream http://github-enterprise-11-10/stash/stash.git (push)"
  47. end
  48. end
  49. assert_equal 'ssh://git@stash.atlassian.com:7999/STASH/stash.git', Atlassian::Stash::Git.get_remote_url
  50. end
  51. end