예제 #1
0
def test_game_add():
    """ Test game adding. """

    game = games.add("Flingler", "LD26 physics game", "http://hostagamejam.com/flingler.png")
    game2 = games.add("Flingler II", "LD27 physics game", "hostagamejam.com/flingler.png")

    assert type(game) == models.Game
    assert type(game2) == models.Game
예제 #2
0
파일: test.py 프로젝트: youdonotexist/gjms
def test_game_add():
    """ Test game adding. """

    game = games.add("Flingler", "LD26 physics game",
                     "http://hostagamejam.com/flingler.png")
    game2 = games.add("Flingler II", "LD27 physics game",
                      "hostagamejam.com/flingler.png")

    assert type(game) == models.Game
    assert type(game2) == models.Game
예제 #3
0
파일: __init__.py 프로젝트: ubergeek42/gjms
def populate_db(entries):
    import gjms.util.report

    import gjms.core.users as users
    import gjms.core.games as games
    import gjms.core.events as events
    import gjms.core.system as system
    import gjms.core.ratings as ratings
    import gjms.core.platforms as platforms

    import datetime
    import elixir

    start1 = datetime.datetime.today() - datetime.timedelta(days=3)
    end1 = datetime.datetime.today() - datetime.timedelta(days=1)

    start2 = datetime.datetime.today() - datetime.timedelta(days=1)
    end2 = datetime.datetime.today() + datetime.timedelta(days=1)

    start3 = datetime.datetime.today() + datetime.timedelta(days=3)
    end3 = datetime.datetime.today() + datetime.timedelta(days=5)

    system = system.get(1)

    event1 = events.add(start1, end1, "Annual Doe Jam #1", "Birds")
    event2 = events.add(start2, end2, "Annual Doe Jam #2", "Birds")
    event3 = events.add(start3, end3, "Annual Doe Jam #3", "Birds")

    system.events.append(event1)
    system.events.append(event2)
    system.events.append(event3)

    for i in range(0, entries):
        user = users.add("John Doe %s" % i, "password", "*****@*****.**")
        game = games.add("Flappy Doe %s" % i, "A Flappy Bird clone.", "http://hostagamejam.com/media/flappy-doe.png")
        rating = ratings.add(4.0)
        platform1 = platforms.add("Android", "http://hostagamejam.com/media/flappy-doe.apk")
        platform2 = platforms.add("iOS", "http://hostagamejam.com/media/flappy-doe.ipa")

        user.games.append(game)
        user.ratings.append(rating)

        game.ratings.append(rating)
        game.platforms.append(platform1)
        game.platforms.append(platform2)

        event1.participants.append(user)
        event1.games.append(game)

        system.users.append(user)
        system.games.append(game)
        system.ratings.append(rating)
        system.platforms.append(platform1)
        system.platforms.append(platform2)

        elixir.session.commit()

        gjms.util.report.output("%d of %d entries added to database." % (i+1, entries))
    return "%s - %d entries successfully added to database." % (user.system.name, entries)