Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

test_common.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import subprocess
  2. import tempfile
  3. import unittest
  4. from dataladmetadatamodel.common import (
  5. get_top_level_metadata_objects,
  6. get_top_nodes_and_metadata_root_record,
  7. )
  8. from dataladmetadatamodel.metadatapath import MetadataPath
  9. from dataladmetadatamodel.metadatarootrecord import MetadataRootRecord
  10. from dataladmetadatamodel.tests.utils import get_uuid
  11. from dataladmetadatamodel.uuidset import UUIDSet
  12. from dataladmetadatamodel.versionlist import TreeVersionList
  13. uuid_0 = get_uuid(0)
  14. class TestTopLevelObjects(unittest.TestCase):
  15. # This is not exactly a unit test since it does not
  16. # isolate the units from the other components, but
  17. # more a module test.
  18. def test_top_level_functions(self):
  19. with tempfile.TemporaryDirectory() as realm:
  20. subprocess.run(["git", "init", realm])
  21. tvl, uuid_set = get_top_level_metadata_objects("git", realm)
  22. self.assertIsNone(tvl)
  23. self.assertIsNone(uuid_set)
  24. tvl, uuid_set, mrr = get_top_nodes_and_metadata_root_record(
  25. "git",
  26. realm,
  27. uuid_0,
  28. "v1",
  29. MetadataPath("a/b/c"),
  30. False
  31. )
  32. self.assertIsNone(tvl)
  33. self.assertIsNone(uuid_set)
  34. self.assertIsNone(mrr)
  35. tvl, uuid_set, mrr = get_top_nodes_and_metadata_root_record(
  36. "git",
  37. realm,
  38. uuid_0,
  39. "v1",
  40. MetadataPath("a/b/c"),
  41. True
  42. )
  43. self.assertIsInstance(tvl, TreeVersionList)
  44. self.assertIsInstance(uuid_set, UUIDSet)
  45. self.assertIsInstance(mrr, MetadataRootRecord)
  46. tvl.write_out(realm)
  47. uuid_set.write_out(realm)
  48. tvl, uuid_set = get_top_level_metadata_objects("git", realm)
  49. self.assertIsInstance(tvl, TreeVersionList)
  50. self.assertIsInstance(uuid_set, UUIDSet)
  51. if __name__ == '__main__':
  52. unittest.main()