def test_0100(self, caplog, tmp_bdb_root): caplog.set_level(logging.INFO) namespace_str = 'ark:/33333/r3' tests.util.util.create_shoulder(namespace_str) django.core.management.call_command('shoulder-mint', namespace_str, '--count', '2') sample.assert_match(caplog.text, 'minted')
def test_1030(self, caplog, tmp_bdb_root): """Creating a full shoulder without specifying the shoulder causes the minters to be stored in a separate directory named 'NULL'. """ ns_str = 'ark:/99920/' org_str = '91101/r01 test org' assert not ezidapp.models.Shoulder.objects.filter( prefix=ns_str).exists() django.core.management.call_command( # <ns> <org-name> 'shoulder-create-ark', ns_str, org_str, '--super-shoulder', '--force', '--test', ) ezid_uri = "ezid:/99920/NULL" assert ezidapp.models.Shoulder.objects.filter(prefix=ns_str).exists() s = ezidapp.models.Shoulder.objects.filter(minter=ezid_uri).get() sample.assert_match(tests.util.util.shoulder_to_dict(s), 'NULL') assert s.minter == ezid_uri assert s.name == org_str assert s.active assert s.isSupershoulder assert s.isTest
def test_1070(shoulder_csv): """IdNamespace(): Initialize from set of known good shoulders""" result_list = [] for ns_str, org_str, n2t_url in shoulder_csv: result_list.append('{:<20s} {}'.format( ns_str, id_ns.IdNamespace.from_str(ns_str).as_tup(), )) sample.assert_match(u'\n'.join(result_list), 'from_str')
def test_1000(self, caplog, tmp_bdb_root): """Creating basic ARK shoulder returns expected messages""" caplog.set_level(logging.INFO) assert not ezidapp.models.Shoulder.objects.filter( prefix='ark:/91101/r01').exists() django.core.management.call_command( # <ns> <org-name> 'shoulder-create-ark', 'ark:/91101/r01', '91101/r01 test org', ) sample.assert_match(caplog.text, 'output')
def test_1010(self, caplog): """Activating a shoulder causes expected change in database""" s = ezidapp.models.Shoulder.objects.filter( prefix='ark:/87610/t6').get() assert not s.active django.core.management.call_command( # <naan> <shoulder> <name> 'shoulder-activate', 'ark:/87610/t6', ) s = ezidapp.models.Shoulder.objects.filter( prefix='ark:/87610/t6').get() assert s.active sample.assert_match(tests.util.util.shoulder_to_dict(s), 'activated')
def test_1020(self, caplog, tmp_bdb_root): """Creating DataCite DOI returns error if datacenter is invalid""" caplog.set_level(logging.INFO) assert not ezidapp.models.Shoulder.objects.filter( prefix='doi:10.9111/R01').exists() with pytest.raises(django.core.management.CommandError) as e: django.core.management.call_command( # <ns> <org-name> 'shoulder-create-doi', 'doi:10.9111/R01', '91101/r01 test org', '--datacite', 'invalid-data-center', ) sample.assert_match(caplog.text, 'invalid_datacenter')
def test_1010(self, ez_admin, tmp_bdb_root, minters): """Test /view""" result_list = [] for ns, arg_tup in minters: result_dict = self._mint(ez_admin, str(ns)) minted_id = result_dict['status_message'] response = ez_admin.get( "/id/{}".format(tests.util.util.encode(minted_id)), content_type="text/plain; charset=UTF-8", ) result_dict = anvl.response_to_dict(response.content) result_dict['_url'] = str(ns) if '_created' in result_dict: result_list.append(result_dict) sample.assert_match(result_list, 'view')
def test_1010(self, caplog, tmp_bdb_root): """Creating a basic ARK shoulder creates expected database entries""" assert not ezidapp.models.Shoulder.objects.filter( prefix='ark:/91101/r01').exists() django.core.management.call_command( # <ns> <org-name> 'shoulder-create-ark', 'ark:/91101/r01', '91101/r01 test org', ) s = ezidapp.models.Shoulder.objects.filter( prefix='ark:/91101/r01').get() sample.assert_match(tests.util.util.shoulder_to_dict(s), 'basic') assert s.active assert not s.isSupershoulder assert not s.isTest
def test_1030(self, caplog, tmp_bdb_root): """Creating DataCite DOI shoulder creates expected database entries""" assert not ezidapp.models.Shoulder.objects.filter( prefix='doi:10.9111/R01').exists() django.core.management.call_command( # <ns> <org-name> 'shoulder-create-doi', 'doi:10.9111/R01', '91101/r01 test org', '--datacite', 'CDL.UCLA', ) s = ezidapp.models.Shoulder.objects.filter( prefix='doi:10.9111/R01').get() sample.assert_match(tests.util.util.shoulder_to_dict(s), 'datacite') assert s.active assert not s.isSupershoulder assert not s.prefix_shares_datacenter assert not s.isTest
def test_1000(self, caplog): caplog.set_level(logging.INFO) shoulder.dump_shoulders() sample.assert_match(caplog.text, 'list')