Example #1
0
    def test_get_tests_paged(self):
        session = Session()
        release = Release(version=31, support="RELEASE")
        session.add(release)
        for r in range(26):
            run = TestRun(
                kernel_version="5.{}.0".format(r),
                build_release="300.fc30",
                arch="ppc64le",
                release=release,
                user="******",
            )
            test = Test(
                name="Secure Boot",
                passed=True,
                waived=False,
                details="Signature valid",
                run=run,
            )
            session.add_all([run, test])
        session.commit()

        result = self.flask_client.get("/release/31")
        assert result.status_code == 200
        for r in range(1, 26):
            assert "5.{}.0".format(r) in result.get_data(as_text=True)
        assert "5.0.0" not in result.get_data(as_text=True)

        result = self.flask_client.get("/release/31?page=2")
        assert "5.0.0" in result.get_data(as_text=True)
Example #2
0
    def test_get(self):
        """Assert releases can be retrieved"""
        session = Session()
        session.add(Release(version=31, support="RAWHIDE"))
        session.commit()

        result = self.flask_client.get("/release/31")

        assert result.status_code == 200
Example #3
0
    def test_get_with_releases(self):
        session = Session()
        session.add(Release(version=31, support="RAWHIDE"))
        session.add(Release(version=30, support="RELEASE"))
        session.add(Release(version=29, support="RETIRED"))
        session.commit()

        result = self.flask_client.get("/")

        assert result.status_code == 200
        assert "Fedora Rawhide" in result.get_data(as_text=True)
        assert "Fedora 30" in result.get_data(as_text=True)
        assert "Fedora 29" not in result.get_data(as_text=True)
Example #4
0
    def test_get(self):
        """Assert retrieving stats with a populated database works."""
        session = Session()
        for v in range(5):
            release = Release(version=v, support="RAWHIDE")
            session.add(release)
            for k in range(10):
                for u in range(100):
                    run = TestRun(
                        kernel_version="{}.{}.0".format(v, k),
                        build_release="300.fc30",
                        arch="aarch64",
                        release=release,
                        user=str(u),
                    )
                    test1 = Test(
                        name="Secure Boot",
                        passed=True,
                        waived=False,
                        details="Signature valid",
                        run=run,
                    )
                    test2 = Test(
                        name="Boot Test",
                        passed=True,
                        waived=False,
                        details="Much boot",
                        run=run,
                    )
                    session.add_all([run, test1, test2])
        session.commit()

        result = self.flask_client.get("/stats")
        assert result.status_code == 200
        assert "<th>Number of tests</th>\n    <td>5000</td>" in result.get_data(
            as_text=True)
        assert "<th>Number of kernels tested</th>\n    <td>50</td>" in result.get_data(
            as_text=True)
        assert "<th>Number of arches tested</th>\n    <td>1</td>" in result.get_data(
            as_text=True)
Example #5
0
    def test_get_tests_paged(self):
        """Assert only 25 tests per page are returned."""
        session = Session()
        release = Release(version=31, support="RELEASE")
        session.add(release)
        for r in range(26):
            run = TestRun(
                kernel_version="5.1.0",
                build_release="300.fc30",
                arch="ppc64le",
                release=release,
                user=str(r),
            )
            test = Test(
                name="Secure Boot",
                passed=True,
                waived=False,
                details="Signature valid",
                run=run,
            )
            session.add_all([run, test])
        session.commit()

        result = self.flask_client.get("/kernel/5.1.0")

        assert result.status_code == 200
        tests = [
            w for w in result.get_data(as_text=True).split()
            if w.strip() == "<td>5.1.0</td>"
        ]
        assert len(tests) == 25

        result = self.flask_client.get("/kernel/5.1.0?page=2")
        tests = [
            w for w in result.get_data(as_text=True).split()
            if w.strip() == "<td>5.1.0</td>"
        ]
        assert len(tests) == 1