Skip to content

Commit

Permalink
create a minter for the agent shoulder for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjiang committed Oct 17, 2023
1 parent b3507ad commit 1f50e88
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,20 @@ def minters(namespace, meta_type):
)
yield namespace

@pytest.fixture()
def agent_minter():
"""Create the minter for the CDL Agent shoulder.
The Agent shoulder (ark:/99166/p9) is already in the DB ready for use.
The corresponding minter is not as the test DB was created before BDB minter to mysql migration.
Create the corresponding minter in the DB.
"""
prefix = 'ark:/99166/p9'
if not ezidapp.models.minter.Minter.objects.filter(
prefix=prefix
).exists():
impl.nog_sql.ezid_minter.create_minter_database(prefix)


@pytest.fixture()
def shoulder_csv():
Expand Down
6 changes: 3 additions & 3 deletions tests/test_group_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

log = logging.getLogger(__name__)

class TestGropu:
def test_1_create_group(self, caplog):
class TestGroup:
def test_1_create_group(self, caplog, agent_minter):
"""test - Create group with group ID minted on Agent shoulder"""
caplog.set_level(logging.INFO)

next_spin = '154dv8s'
next_spin = '4w25'
expected_pid = f'{django.conf.settings.SHOULDERS_AGENT}{next_spin}'

assert not ezidapp.models.group.Group.objects.filter(
Expand Down
10 changes: 5 additions & 5 deletions tests/test_user_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
log = logging.getLogger(__name__)

class TestUser:
def test_1_create_user(self, caplog):
def test_1_create_user(self, caplog, agent_minter):
"""test - Create user with user ID minted on Agent shoulder"""
caplog.set_level(logging.INFO)

next_spin = '154dv8s'
next_spin = '4w25'
expected_pid = f'{django.conf.settings.SHOULDERS_AGENT}{next_spin}'

assert not ezidapp.models.user.User.objects.filter(
Expand All @@ -35,9 +35,9 @@ def test_1_create_user(self, caplog):

user.save()

assert ezidapp.models.user.User.objects.filter(
pid=expected_pid
).exists()
# assert ezidapp.models.user.User.objects.filter(
# pid=expected_pid
# ).exists()

user = ezidapp.models.user.User.objects.get(pid=expected_pid)

Expand Down

0 comments on commit 1f50e88

Please sign in to comment.