def test_dev_leaderboard(self):
        UserCode(
            user="******",
            code_link="https://gitlab.com/real_url/raw/circuswire.js",
            code_type="js",
            owners=["future", "uzi"],
            approved=True,
        ).save()

        UserCode(
            user="******",
            code_link="https://gitlab.com/real_url/raw/bubbles.js",
            code_type="js",
            owners=["future"],
            approved=True,
        ).save()

        UserCode(
            user="******",
            code_link="https://gitlab.com/real_url/raw/thetwin.js",
            code_type="js",
            owners=["future", "uzi", "wharf"],
            approved=True,
        ).save()

        result = UserCode.dev_leaderboard()
        assert result == [("richard", 3), ("satie", 2), ("eno", 1)]
Beispiel #2
0
async def generate_widgets_page(winner):
    widgets = UserCode.all()
    dev_leaderboard = UserCode.dev_leaderboard()

    context = {
        "base_url": DEPLOY_URL,
        "widgets": widgets,
        "winner": winner,
        "dev_leaderboard": dev_leaderboard,
    }
    await _render_and_save_html("widgets.html", context, "widgets.html")