def test_cross_tip_doesnt_become_self_tip(self): alice = TwitterAccount(self.db, 1, dict(screen_name='alice')) bob = TwitterAccount(self.db, 2, dict(screen_name='bob')) alice_participant = alice.opt_in('alice')[0].participant bob_participant = bob.opt_in('bob')[0].participant alice_participant.set_tip_to('bob', '1.00') bob_participant.take_over(alice, have_confirmation=True) self.db.self_check()
def test_cross_tip_doesnt_become_self_tip(self): alice = TwitterAccount(self.db, 1, dict(screen_name='alice')) bob = TwitterAccount(self.db, 2, dict(screen_name='bob')) alice_participant = alice.opt_in('alice')[0].participant bob_participant = bob.opt_in('bob')[0].participant alice_participant.set_tip_to('bob', '1.00') bob_participant.take_over(alice, have_confirmation=True) self.self_test()
def test_do_not_take_over_zero_tips_receiving(self): alice = TwitterAccount(self.db, 1, dict(screen_name='alice')) bob = TwitterAccount(self.db, 2, dict(screen_name='bob')) carl = TwitterAccount(self.db, 3, dict(screen_name='carl')) alice_participant = alice.opt_in('alice')[0].participant bob_participant = bob.opt_in('bob')[0].participant carl_participant = carl.opt_in('carl')[0].participant bob_participant.set_tip_to('carl', '1.00') bob_participant.set_tip_to('carl', '0.00') alice_participant.take_over(carl, have_confirmation=True) ntips = self.db.one("select count(*) from tips") assert 2 == ntips self.db.self_check()
def test_do_not_take_over_zero_tips_receiving(self): alice = TwitterAccount(self.db, 1, dict(screen_name='alice')) bob = TwitterAccount(self.db, 2, dict(screen_name='bob')) carl = TwitterAccount(self.db, 3, dict(screen_name='carl')) alice_participant = alice.opt_in('alice')[0].participant bob_participant = bob.opt_in('bob')[0].participant carl_participant = carl.opt_in('carl')[0].participant bob_participant.set_tip_to('carl', '1.00') bob_participant.set_tip_to('carl', '0.00') alice_participant.take_over(carl, have_confirmation=True) ntips = self.db.one("select count(*) from tips") assert 2 == ntips self.self_test()
def test_idempotent(self): alice = TwitterAccount(self.db, 1, dict(screen_name='alice')) bob = GitHubAccount(self.db, 2, dict(screen_name='bob')) alice_participant = alice.opt_in('alice')[0].participant alice_participant.take_over(bob, have_confirmation=True) alice_participant.take_over(bob, have_confirmation=True) self.db.self_check()
def test_opt_in_doesnt_have_to_change_username(self): self.make_participant("bob") account = TwitterAccount("alice", {}) expected = account.participant # A random one. actual = account.opt_in("bob")[0].participant.username assert actual == expected
def test_opt_in_can_change_username(self): account = TwitterAccount("alice", {}) expected = "bob" actual = account.opt_in("bob")[0].participant.username assert actual == expected
def test_opt_in_doesnt_have_to_change_username(self): self.make_participant("bob") account = TwitterAccount("alice", {}) expected = account.participant # A random one. actual = account.opt_in("bob")[0].participant.username assert actual == expected, actual
def test_opt_in_can_change_username(self): account = TwitterAccount("alice", {}) expected = "bob" actual = account.opt_in("bob")[0].participant.username assert actual == expected, actual
def test_opt_in_can_changes_username(self): account = TwitterAccount("alice", {}) expected = "bob" actual = account.opt_in("bob").id assert actual == expected, actual