Beispiel #1
0
def pytest_generate_tests(metafunc):
    for fixture in metafunc.fixturenames:
        if fixture.startswith("data_"):
            data = pytest_filedata.get_data(fixture)
            metafunc.parametrize(fixture,
                                 list(data.values()),
                                 ids=list(data.keys()))
Beispiel #2
0
    def test_import_preview_net(self):

        data_ixf_preview_net = pytest_filedata.get_data("data_ixf_preview_net")[
            "test_0"
        ]

        self.ixlan.ixf_ixp_member_list_url = "https://localhost"
        self.ixlan.save()

        cache.set(
            f"IXF-CACHE-{self.ixlan.ixf_ixp_member_list_url}",
            json.loads(data_ixf_preview_net.json),
            timeout=None,
        )

        request = RequestFactory().get(f"/import/net/{self.net.id}/ixf/preview/")
        request.user = self.admin_user

        response = view_import_net_ixf_preview(request, self.net.id)

        data_ixf_preview_net.expected["data"][0]["peer"].update(
            ixlan_id=self.ixlan.id,
            ix_id=self.ixlan.id,
            net_id=self.net.id,
        )

        data_ixf_preview_net.expected["data"][1]["peer"].update(
            ixlan_id=self.ixlan.id,
            ix_id=self.ixlan.id,
            net_id=self.net.id,
        )

        assert response.status_code == 200
        assert (
            json.loads(response.content.decode("utf8")) == data_ixf_preview_net.expected
        )
Beispiel #3
0
def pytest_generate_tests(metafunc):
    for fixture in metafunc.fixturenames:
        if fixture.startswith('data_'):
            data = pytest_filedata.get_data(fixture)
            metafunc.parametrize(fixture, list(data.values()), ids=list(data.keys()))