def test_html_export_event_unknown(event): from django.core.management import call_command # Import here to avoid overriding mocks with pytest.raises(CommandError) as excinfo: call_command('export_schedule_html', 'foobar222') assert 'Could not find event with slug "foobar222"' in str(excinfo.value) export_schedule_html(event_id=22222) export_schedule_html(event_id=event.pk)
def test_html_export_event_unknown(): from django.core.management import call_command with pytest.raises(CommandError) as excinfo: call_command('export_schedule_html', 'foobar222') assert 'Could not find event with slug "foobar222"' in str(excinfo) export_schedule_html(event_id=22222)