-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow reingesting an entire source in the admin
- Loading branch information
Showing
5 changed files
with
116 additions
and
16 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
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
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
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,34 @@ | ||
{% extends "admin/base_site.html" %} | ||
{% load i18n %} | ||
|
||
{% block extrastyle %} | ||
<style> | ||
section, table { | ||
padding-left: 2em; | ||
} | ||
form { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
</style> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<h1>{% trans "schedule ingest" %}</h1> | ||
<section> | ||
<h2>for source config "{{ source_config.label }}"</h2> | ||
<form method="post"> | ||
{% csrf_token %} | ||
<input type="hidden" name="source_config_label" value={{source_config.label}} /> | ||
<label> | ||
<input type="checkbox" name="pls_reformat" /> | ||
{% trans "pls reformat (even if already formatted)" %} | ||
</label> | ||
<label> | ||
<input type="checkbox" name="pls_renormalize" /> | ||
{% trans "pls renormalize (even if already normalized)" %} | ||
</label> | ||
<input type="submit" value="{% trans "yum yum" %}" /> | ||
</form> | ||
</section> | ||
{% endblock %} |
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,26 @@ | ||
from unittest import mock | ||
|
||
import pytest | ||
|
||
from share.tasks import schedule_reingest | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_schedule_reingest(source_config): | ||
for yes_renormalize in (True, False): | ||
for yes_reformat in (True, False): | ||
with mock.patch('django.core.management.call_command') as mock_call_command: | ||
schedule_reingest.apply( | ||
(source_config.pk,), | ||
{ | ||
'pls_renormalize': yes_renormalize, | ||
'pls_reformat': yes_reformat, | ||
}, | ||
) | ||
mock_call_command.assert_called_once_with( | ||
'format_metadata_records', | ||
source_config=[source_config.label], | ||
pls_ensure_ingest_jobs=True, | ||
pls_renormalize=yes_renormalize, | ||
pls_reformat=yes_reformat, | ||
) |