Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

66 lines
2.5KB

  1. import pytest
  2. from dds_ci.dds import DDSWrapper
  3. from dds_ci.testing.fixtures import Project
  4. from dds_ci.testing.http import RepoServer
  5. from dds_ci.testing.error import expect_error_marker
  6. from pathlib import Path
  7. @pytest.fixture()
  8. def tmp_repo(tmp_path: Path, dds: DDSWrapper) -> Path:
  9. dds.run(['repoman', 'init', tmp_path])
  10. return tmp_path
  11. def test_error_bad_pkg_id(dds: DDSWrapper, tmp_repo: Path) -> None:
  12. with expect_error_marker('invalid-pkg-id-str-version'):
  13. dds.run(['repoman', 'add', tmp_repo, 'foo@bar', 'http://example.com'])
  14. with expect_error_marker('invalid-pkg-id-str'):
  15. dds.run(['repoman', 'add', tmp_repo, 'foo', 'http://example.com'])
  16. def test_add_simple(dds: DDSWrapper, tmp_repo: Path) -> None:
  17. dds.run(['repoman', 'add', tmp_repo, 'neo-fun@0.6.0', 'git+https://github.com/vector-of-bool/neo-fun.git#0.6.0'])
  18. with expect_error_marker('dup-pkg-add'):
  19. dds.run(
  20. ['repoman', 'add', tmp_repo, 'neo-fun@0.6.0', 'git+https://github.com/vector-of-bool/neo-fun.git#0.6.0'])
  21. def test_add_github(dds: DDSWrapper, tmp_repo: Path) -> None:
  22. dds.run(['repoman', 'add', tmp_repo, 'neo-fun@0.6.0', 'github:vector-of-bool/neo-fun/0.6.0'])
  23. with expect_error_marker('dup-pkg-add'):
  24. dds.run(['repoman', 'add', tmp_repo, 'neo-fun@0.6.0', 'github:vector-of-bool/neo-fun/0.6.0'])
  25. def test_add_invalid(dds: DDSWrapper, tmp_repo: Path) -> None:
  26. with expect_error_marker('repoman-add-invalid-pkg-url'):
  27. dds.run(['repoman', 'add', tmp_repo, 'foo@1.2.3', 'invalid://google.com/lolwut'])
  28. def test_error_double_remove(tmp_repo: Path, dds: DDSWrapper) -> None:
  29. dds.run([
  30. 'repoman', '-ltrace', 'add', tmp_repo, 'neo-fun@0.4.0',
  31. 'https://github.com/vector-of-bool/neo-fun/archive/0.4.0.tar.gz?__dds_strpcmp=1'
  32. ])
  33. dds.run(['repoman', 'remove', tmp_repo, 'neo-fun@0.4.0'])
  34. with expect_error_marker('repoman-rm-no-such-package'):
  35. dds.run(['repoman', 'remove', tmp_repo, 'neo-fun@0.4.0'])
  36. def test_pkg_http(http_repo: RepoServer, tmp_project: Project) -> None:
  37. tmp_project.dds.run([
  38. 'repoman', '-ltrace', 'add', http_repo.server.root, 'neo-fun@0.4.0',
  39. 'https://github.com/vector-of-bool/neo-fun/archive/0.4.0.tar.gz?__dds_strpcmp=1'
  40. ])
  41. tmp_project.dds.repo_add(http_repo.url)
  42. tmp_project.package_json = {
  43. 'name': 'test',
  44. 'version': '1.2.3',
  45. 'depends': ['neo-fun@0.4.0'],
  46. 'namespace': 'test',
  47. }
  48. tmp_project.build()