def test_scoreboard_tie_break_ordering_with_awards():
    """
    Test that scoreboard tie break ordering respects the addition of awards
    """
    app = create_ctfd()
    with app.app_context():
        # create user1
        register_user(app, name="user1", email="user1@examplectf.com")
        # create user2
        register_user(app, name="user2", email="user2@examplectf.com")

        chal = gen_challenge(app.db, value=100)
        gen_flag(app.db, challenge_id=chal.id, content="flag")

        chal = gen_challenge(app.db, value=200)
        gen_flag(app.db, challenge_id=chal.id, content="flag")

        # create solves for the challenges. (the user_ids are off by 1 because of the admin)
        gen_solve(app.db, user_id=2, challenge_id=1)
        gen_solve(app.db, user_id=3, challenge_id=2)

        with login_as_user(app, "user1") as client:
            r = client.get("/api/v1/scoreboard")
            resp = r.get_json()
            assert len(resp["data"]) == 2
            assert resp["data"][0]["name"] == "user2"
            assert resp["data"][0]["score"] == 200
            assert resp["data"][1]["name"] == "user1"
            assert resp["data"][1]["score"] == 100

        # Give user1 an award for 100 points.
        # At this point user2 should still be ahead
        gen_award(app.db, user_id=2, value=100)

        with login_as_user(app, "user1") as client:
            r = client.get("/api/v1/scoreboard")
            resp = r.get_json()
            assert len(resp["data"]) == 2
            assert resp["data"][0]["name"] == "user2"
            assert resp["data"][0]["score"] == 200
            assert resp["data"][1]["name"] == "user1"
            assert resp["data"][1]["score"] == 200
    destroy_ctfd(app)

    Test that scoreboard tie break ordering respects the addition of awards
    
tests/api/v1/test_scoreboard.py