Exemplo n.º 1
0
def test_vote_add_option():
    vote = vote_manager.create_vote(111, 222, "Add Option Test")
    vote.add_option(Voting.Option("head", "body", 123))
    assert vote.options[0].head == "head"
    assert vote.options[0].body == "body"
    in_db = db_manager.db_execute_select("SELECT * FROM VoteOptions WHERE opt_id=?", (123,))
    assert in_db
Exemplo n.º 2
0
def test_vote_remove_option():
    vote = vote_manager.create_vote(111, 222, "Remove Option Test")
    vote.add_option(Voting.Option("head", "body", 123))
    vote.remove_option(0)
    in_db = db_manager.db_execute_select(
        "SELECT * FROM VoteOptions WHERE opt_id=?", (123, ))
    assert not in_db
Exemplo n.º 3
0
def test_vote_is_ready():
    vote = Voting.Vote(111, "Test Vote", 222, 333, db_manager)
    vote.add_option(Voting.Option(111, "head", "body"))
    assert not vote.is_ready()
    vote.add_option(Voting.Option(122, "head", "body"))
    assert vote.is_ready()
Exemplo n.º 4
0
def test_option():
    opt = Voting.Option("test", "option", 123456789)
    assert opt.id == 123456789
    assert opt.head == "test"
    assert opt.body == "option"