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.

30 lines
804B

  1. import json
  2. from tests import dds, DDS
  3. from tests.fileutil import ensure_dir
  4. def test_import_json(dds: DDS):
  5. dds.scope.enter_context(ensure_dir(dds.build_dir))
  6. cat_path = dds.build_dir / 'catalog.db'
  7. dds.catalog_create(cat_path)
  8. json_fpath = dds.build_dir / 'data.json'
  9. import_data = {
  10. 'version': 1,
  11. 'packages': {
  12. 'foo': {
  13. '1.2.4': {
  14. 'git': {
  15. 'url': 'http://example.com',
  16. 'ref': 'master',
  17. },
  18. 'depends': {},
  19. },
  20. },
  21. },
  22. }
  23. dds.scope.enter_context(
  24. dds.set_contents(json_fpath,
  25. json.dumps(import_data).encode()))
  26. dds.catalog_import(cat_path, json_fpath)