Fix source actions and toggle regressions
This commit is contained in:
parent
94717b1d1b
commit
2a99edeec3
5 changed files with 122 additions and 5 deletions
|
|
@ -430,6 +430,37 @@ def test_render_sources_shows_table_and_create_link() -> None:
|
|||
asyncio.run(run())
|
||||
|
||||
|
||||
def test_render_sources_shows_delete_action_for_each_source(
|
||||
monkeypatch, tmp_path: Path
|
||||
) -> None:
|
||||
db_path = tmp_path / "sources-delete-row.db"
|
||||
monkeypatch.setenv("REPUBLISHER_DB_PATH", str(db_path))
|
||||
app = create_app()
|
||||
create_source(
|
||||
name="Delete me",
|
||||
slug="delete-me",
|
||||
source_type="feed",
|
||||
notes="",
|
||||
spider_arguments="",
|
||||
enabled=True,
|
||||
cron_minute="0",
|
||||
cron_hour="*",
|
||||
cron_day_of_month="*",
|
||||
cron_day_of_week="*",
|
||||
cron_month="*",
|
||||
feed_url="https://example.com/delete.xml",
|
||||
)
|
||||
|
||||
async def run() -> None:
|
||||
body = str(await render_sources(app))
|
||||
|
||||
assert "Delete" in body
|
||||
assert "data-on:pointerdown" in body
|
||||
assert "/actions/sources/delete-me/delete" in body
|
||||
|
||||
asyncio.run(run())
|
||||
|
||||
|
||||
def test_render_create_source_shows_dedicated_form_page() -> None:
|
||||
async def run() -> None:
|
||||
body = str(await render_create_source())
|
||||
|
|
@ -537,7 +568,7 @@ def test_create_source_action_creates_pangea_source_and_job_in_database(
|
|||
"sourceSlug": "kenya-health",
|
||||
"sourceType": "pangea",
|
||||
"pangeaDomain": "example.org",
|
||||
"pangeaCategory": "Health",
|
||||
"pangeaCategory": " Health ",
|
||||
"contentFormat": "MOBILE_3",
|
||||
"contentType": "breakingnews",
|
||||
"maxArticles": "12",
|
||||
|
|
@ -567,13 +598,13 @@ def test_create_source_action_creates_pangea_source_and_job_in_database(
|
|||
|
||||
assert source.name == "Kenya health desk"
|
||||
assert source.source_type == "pangea"
|
||||
assert pangea.category_name == " Health "
|
||||
assert pangea.content_type == "breakingnews"
|
||||
assert pangea.include_content is True
|
||||
assert job.enabled is True
|
||||
assert job.spider_arguments == "language=en\ndownload_media=true"
|
||||
assert job.cron_hour == "*/6"
|
||||
assert "kenya-health" in rendered_sources
|
||||
assert "example.org / Health" in rendered_sources
|
||||
assert "Enabled" in rendered_sources
|
||||
|
||||
asyncio.run(run())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue