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.

36 lines
935B

  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. '1.2.5': {
  20. 'git': {
  21. 'url': 'http://example.com',
  22. 'ref': 'master',
  23. },
  24. },
  25. },
  26. },
  27. }
  28. dds.scope.enter_context(
  29. dds.set_contents(json_fpath,
  30. json.dumps(import_data).encode()))
  31. dds.catalog_import(json_fpath)