-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d359fff
commit 385bc52
Showing
5 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 3.2.18 on 2023-07-13 16:43 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ezidapp', '0002_auto_20221026_1139'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='binderqueue', | ||
name='status', | ||
field=models.CharField(choices=[('U', 'Awaiting submission'), ('C', 'Submitted, unchecked'), ('S', 'Submitted'), ('W', 'Registered with warning'), ('F', 'Registration failed'), ('T', 'Registration attempt unsuccessful'), ('I', 'Ignored (operation not applicable)'), ('O', 'Completed successfully')], db_index=True, default='U', max_length=1), | ||
), | ||
migrations.AlterField( | ||
model_name='crossrefqueue', | ||
name='status', | ||
field=models.CharField(choices=[('U', 'Awaiting submission'), ('C', 'Submitted, unchecked'), ('S', 'Submitted'), ('W', 'Registered with warning'), ('F', 'Registration failed'), ('T', 'Registration attempt unsuccessful'), ('I', 'Ignored (operation not applicable)'), ('O', 'Completed successfully')], db_index=True, default='U', max_length=1), | ||
), | ||
migrations.AlterField( | ||
model_name='datacitequeue', | ||
name='status', | ||
field=models.CharField(choices=[('U', 'Awaiting submission'), ('C', 'Submitted, unchecked'), ('S', 'Submitted'), ('W', 'Registered with warning'), ('F', 'Registration failed'), ('T', 'Registration attempt unsuccessful'), ('I', 'Ignored (operation not applicable)'), ('O', 'Completed successfully')], db_index=True, default='U', max_length=1), | ||
), | ||
migrations.AlterField( | ||
model_name='searchindexerqueue', | ||
name='status', | ||
field=models.CharField(choices=[('U', 'Awaiting submission'), ('C', 'Submitted, unchecked'), ('S', 'Submitted'), ('W', 'Registered with warning'), ('F', 'Registration failed'), ('T', 'Registration attempt unsuccessful'), ('I', 'Ignored (operation not applicable)'), ('O', 'Completed successfully')], db_index=True, default='U', max_length=1), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 3.2.18 on 2023-07-13 17:35 | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
import re | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ezidapp', '0003_auto_20230713_1643'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ProfileCopy', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('label', models.CharField(max_length=32, unique=True, validators=[django.core.validators.RegexValidator('^[a-z0-9]+([-_.][a-z0-9]+)*$', 'Invalid profile name.', flags=re.RegexFlag['IGNORECASE'])])), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 3.2.18 on 2023-07-13 17:55 | ||
|
||
from django.db import migrations, models | ||
import ezidapp.models.validation | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ezidapp', '0004_profilecopy'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='profilecopy', | ||
name='prefix', | ||
field=models.CharField(default='ark:/99999/fk8', max_length=255, unique=True, validators=[ezidapp.models.validation.shoulder]), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright©2021, Regents of the University of California | ||
# http://creativecommons.org/licenses/BSD | ||
|
||
"""Abstract database model for metadata profiles. | ||
""" | ||
|
||
import re | ||
|
||
import django.core.validators | ||
import django.db.models | ||
import impl.util | ||
|
||
import impl | ||
from ezidapp.models import validation | ||
|
||
|
||
class ProfileCopy(django.db.models.Model): | ||
label = django.db.models.CharField( | ||
max_length=32, | ||
unique=True, | ||
validators=[ | ||
django.core.validators.RegexValidator( | ||
"^[a-z0-9]+([-_.][a-z0-9]+)*$", "Invalid profile name.", flags=re.I | ||
) | ||
], | ||
) | ||
|
||
prefix = django.db.models.CharField( | ||
max_length=impl.util.maxIdentifierLength, | ||
unique=True, | ||
validators=[validation.shoulder], | ||
default='ark:/99999/fk8' | ||
) | ||
# The profile's label, e.g., "erc". | ||
|
||
def clean(self): | ||
self.label = self.label.strip() | ||
|
||
def __str__(self): | ||
return self.label | ||
|
||
|
||
# if caches is None: | ||
# labelCache = dict((p.label, p) for p in Profile.objects.all()) | ||
# idCache = dict((p.id, p) for p in list(labelCache.values())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: EZID Py Test | ||
tags: [] | ||
--- | ||
|
||
1. Set up virtual environment | ||
|
||
```python | ||
python3 -m venv .test-venv | ||
``` | ||
|
||
2. Activate virtual environment | ||
```python | ||
source .test-venv/bin/activate | ||
``` | ||
|
||
|
||
3. Install requirements.txt | ||
```python | ||
pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-dev.txt | ||
``` | ||
|
||
|
||
4. Set up Django settings module | ||
```bash | ||
export DJANGO_SETTINGS_MODULE=settings.tests | ||
``` | ||
|
||
5. Start mysql | ||
```bash | ||
brew services start mysql | ||
``` | ||
|
||
6. Run mysql_test_setup.sh | ||
```bash | ||
shell tests/mysql_test_setup.sh | ||
``` | ||
|
||
7. Set up file system | ||
```bash | ||
mkdir -p ../download/public ../logs | ||
``` | ||
|
||
8. Setup DB and static files | ||
```python | ||
./manage.py migrate | ||
./manage.py collectstatic --no-input | ||
``` | ||
|
||
9. Load DB fixture | ||
```python | ||
./manage.py loaddata db | ||
``` | ||
|
||
10. Run tests | ||
```python | ||
pytest --maxfail 10 | ||
``` |