test_pull.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # vim: set fileencoding=utf-8 :
  2. #
  3. # (C) 2017 Guido Günther <agx@sigxcpu.org>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, please see
  17. # <http://www.gnu.org/licenses/>
  18. import os
  19. from tests.component import (ComponentTestBase,
  20. ComponentTestGitRepository)
  21. from tests.component.deb.fixtures import RepoFixtures
  22. from nose.tools import eq_
  23. from gbp.scripts.clone import main as clone
  24. from gbp.scripts.pull import main as pull
  25. class TestPull(ComponentTestBase):
  26. """Test cloning from a remote"""
  27. @RepoFixtures.native()
  28. def test_pull_explicit_remote(self, repo):
  29. """Test that pulling of debian native packages works"""
  30. dest = os.path.join(self._tmpdir, 'cloned_repo')
  31. clone(['arg0', repo.path, dest])
  32. cloned = ComponentTestGitRepository(dest)
  33. self._check_repo_state(cloned, 'master', ['master'])
  34. eq_(pull(['argv0', 'origin']), 0)
  35. assert len(repo.get_commits()) == 1
  36. @RepoFixtures.native()
  37. def test_pull_default_remote(self, repo):
  38. """Test that pulling of debian native packages works"""
  39. dest = os.path.join(self._tmpdir, 'cloned_repo')
  40. clone(['arg0', repo.path, dest])
  41. cloned = ComponentTestGitRepository(dest)
  42. self._check_repo_state(cloned, 'master', ['master'])
  43. eq_(pull(['argv0']), 0)
  44. assert len(repo.get_commits()) == 1