test_model.py 678 B

12345678910111213141516171819202122
  1. from builtins import object
  2. import ckanext.archiver.model as archiver_model
  3. from ckan.tests import factories as ckan_factories
  4. from ckan import model
  5. import pytest
  6. Archival = archiver_model.Archival
  7. class TestArchival(object):
  8. @pytest.fixture(autouse=True)
  9. @pytest.mark.usefixtures(u"clean_db")
  10. def initial_data(self, clean_db):
  11. archiver_model.init_tables(model.meta.engine)
  12. def test_create(self):
  13. dataset = ckan_factories.Dataset()
  14. res = ckan_factories.Resource(package_id=dataset['id'])
  15. archival = Archival.create(res['id'])
  16. assert isinstance(archival, Archival)
  17. assert archival.package_id == dataset['id']