mirror of
				https://github.com/peeringdb/peeringdb.git
				synced 2024-05-11 05:55:09 +00:00 
			
		
		
		
	Prep 2.29 (#1024)
* django3, py39, lgtm, linting (#715) * IX-F Importer: ticket status change when posting re-occuring conflict to existing resolved ticket (#920) * fix recaptcha requirement for user creation in django-admin (#715) * IX-F Importer: fix command output buffering #967 * Drop dot1q_support field #903 * fix test (#967) * Add name, city, country to ixfac (GET operation) #166 * additional tests fir #166 * Allow IXP to trigger ix-f importer for their exchange #779 * add docker compose for dev * add selinux labels for mountpoints * fixes #1013: The process to permanently remove old soft-deleted network contacts pdb_delete_pocs raises a false ProtectedAction * fix api test * relock poetry * remove django_namespace_perms from installed apps * fix user permissios ui * remove remaining references to django namespace perms * linting * copy tox.ini * comment flake8 check until we figure out why it ignores configs from tox.ini * black format * poetry lock Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
		@@ -44,6 +44,23 @@ def test_reset_hints(entities, data_cmd_ixf_hints):
 | 
			
		||||
    assert DeskProTicket.objects.filter(body__contains="reset_hints").count() == 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.django_db
 | 
			
		||||
def test_reset_process_requested(entities):
 | 
			
		||||
    ixlan = entities["ixlan"]
 | 
			
		||||
    ixlan.ixf_ixp_member_list_url = "localhost"
 | 
			
		||||
    ixlan.ixf_ixp_import_enabled = True
 | 
			
		||||
    ixlan.save()
 | 
			
		||||
 | 
			
		||||
    ixlan.ix.request_ixf_import()
 | 
			
		||||
 | 
			
		||||
    call_command("pdb_ixf_ixp_member_import", process_requested=0, commit=True)
 | 
			
		||||
 | 
			
		||||
    ixlan.ix.refresh_from_db()
 | 
			
		||||
 | 
			
		||||
    assert ixlan.ix.ixf_import_request_status == "finished"
 | 
			
		||||
    assert ixlan.ix.ixf_import_request
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.django_db
 | 
			
		||||
def test_reset_dismissals(entities, data_cmd_ixf_dismissals):
 | 
			
		||||
    ixf_import_data = json.loads(data_cmd_ixf_dismissals.json)
 | 
			
		||||
@@ -153,6 +170,8 @@ def test_runtime_errors(entities, capsys, mocker):
 | 
			
		||||
        side_effect=RuntimeError("Unexpected error"),
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    out = io.StringIO()
 | 
			
		||||
 | 
			
		||||
    with pytest.raises(SystemExit) as pytest_wrapped_exit:
 | 
			
		||||
        call_command(
 | 
			
		||||
            "pdb_ixf_ixp_member_import",
 | 
			
		||||
@@ -160,14 +179,15 @@ def test_runtime_errors(entities, capsys, mocker):
 | 
			
		||||
            commit=True,
 | 
			
		||||
            ixlan=[ixlan.id],
 | 
			
		||||
            asn=asn,
 | 
			
		||||
            stdout=out,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    # Assert we are outputting the exception and traceback to the stderr
 | 
			
		||||
    captured = capsys.readouterr()
 | 
			
		||||
    assert "Unexpected error" in captured.err
 | 
			
		||||
    assert str(ixlan.id) in captured.err
 | 
			
		||||
    assert str(ixlan.ix.name) in captured.err
 | 
			
		||||
    assert str(ixlan.ixf_ixp_member_list_url) in captured.err
 | 
			
		||||
    captured = out.getvalue()
 | 
			
		||||
    assert "Unexpected error" in captured
 | 
			
		||||
    assert str(ixlan.id) in captured
 | 
			
		||||
    assert str(ixlan.ix.name) in captured
 | 
			
		||||
    assert str(ixlan.ixf_ixp_member_list_url) in captured
 | 
			
		||||
 | 
			
		||||
    # Assert we are exiting with status code 1
 | 
			
		||||
    assert pytest_wrapped_exit.value.code == 1
 | 
			
		||||
 
 | 
			
		||||
@@ -182,6 +182,39 @@ def test_tech_poc_protection(role, deletable):
 | 
			
		||||
    poc.delete()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.django_db
 | 
			
		||||
@pytest.mark.parametrize(
 | 
			
		||||
    "role",
 | 
			
		||||
    [
 | 
			
		||||
        "Technical",
 | 
			
		||||
        "Policy",
 | 
			
		||||
        "NOC",
 | 
			
		||||
        "Abuse",
 | 
			
		||||
        "Maintenance",
 | 
			
		||||
        "Public Relations",
 | 
			
		||||
        "Sales",
 | 
			
		||||
    ],
 | 
			
		||||
)
 | 
			
		||||
def test_tech_poc_hard_delete_1013(role):
 | 
			
		||||
    """
 | 
			
		||||
    Test that already soft-deleted pocs dont raise
 | 
			
		||||
    a protected action error when hard-deleting (#1013)
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    call_command("pdb_generate_test_data", limit=2, commit=True)
 | 
			
		||||
 | 
			
		||||
    net = Network.objects.first()
 | 
			
		||||
 | 
			
		||||
    net.poc_set.all().delete()
 | 
			
		||||
 | 
			
		||||
    poc_a = NetworkContact.objects.create(status="ok", role="Technical", network=net)
 | 
			
		||||
    poc_b = NetworkContact.objects.create(status="deleted", role=role, network=net)
 | 
			
		||||
    poc_b.delete(hard=True)
 | 
			
		||||
 | 
			
		||||
    poc_a.delete(force=True)
 | 
			
		||||
    poc_a.delete(hard=True)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.django_db
 | 
			
		||||
def test_org_protection_sponsor(db):
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,6 @@
 | 
			
		||||
import pytest
 | 
			
		||||
import pytest_filedata
 | 
			
		||||
 | 
			
		||||
from peeringdb_server.inet import RdapAsn
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def assert_parsed(data, parsed):
 | 
			
		||||
    # dump in json format for easily adding expected
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user