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.

import_test.py 743B

1234567891011121314151617181920212223242526272829
  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. dds.catalog_create()
  7. json_fpath = dds.build_dir / 'data.json'
  8. import_data = {
  9. 'version': 1,
  10. 'packages': {
  11. 'foo': {
  12. '1.2.4': {
  13. 'git': {
  14. 'url': 'http://example.com',
  15. 'ref': 'master',
  16. },
  17. 'depends': {},
  18. },
  19. },
  20. },
  21. }
  22. dds.scope.enter_context(
  23. dds.set_contents(json_fpath,
  24. json.dumps(import_data).encode()))
  25. dds.catalog_import(json_fpath)