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.

50 line
1.6KB

  1. from dds_ci.dds import DDSWrapper
  2. from dds_ci.testing import Project, RepoFixture, PackageJSON
  3. from dds_ci.testing.error import expect_error_marker
  4. NEO_SQLITE_PKG_JSON = {
  5. 'packages': {
  6. 'neo-sqlite3': {
  7. '0.3.0': {
  8. 'remote': {
  9. 'git': {
  10. 'url': 'https://github.com/vector-of-bool/neo-sqlite3.git',
  11. 'ref': '0.3.0',
  12. }
  13. }
  14. }
  15. }
  16. }
  17. }
  18. def test_pkg_get(http_repo: RepoFixture, tmp_project: Project) -> None:
  19. http_repo.import_json_data(NEO_SQLITE_PKG_JSON)
  20. tmp_project.dds.repo_add(http_repo.url)
  21. tmp_project.dds.pkg_get('neo-sqlite3@0.3.0')
  22. assert tmp_project.root.joinpath('neo-sqlite3@0.3.0').is_dir()
  23. assert tmp_project.root.joinpath('neo-sqlite3@0.3.0/package.jsonc').is_file()
  24. def test_pkg_repo(http_repo: RepoFixture, tmp_project: Project) -> None:
  25. dds = tmp_project.dds
  26. dds.repo_add(http_repo.url)
  27. dds.run(['pkg', 'repo', dds.catalog_path_arg, 'ls'])
  28. def test_pkg_repo_rm(http_repo: RepoFixture, tmp_project: Project) -> None:
  29. http_repo.import_json_data(NEO_SQLITE_PKG_JSON)
  30. dds = tmp_project.dds
  31. dds.repo_add(http_repo.url)
  32. # Okay:
  33. tmp_project.dds.pkg_get('neo-sqlite3@0.3.0')
  34. # Remove the repo:
  35. dds.run(['pkg', dds.catalog_path_arg, 'repo', 'ls'])
  36. dds.repo_remove(http_repo.repo_name)
  37. # Cannot double-remove a repo:
  38. with expect_error_marker('repo-rm-no-such-repo'):
  39. dds.repo_remove(http_repo.repo_name)
  40. # Now, fails:
  41. with expect_error_marker('pkg-get-no-pkg-id-listing'):
  42. tmp_project.dds.pkg_get('neo-sqlite3@0.3.0')