Exemplo n.º 1
0
 def test_user_can_be_loaded_from_session_token(self):
     self.make_participant('alice')
     token = User.from_id('alice').session_token
     actual = User.from_session_token(token).id
     assert actual == 'alice', actual
Exemplo n.º 2
0
 def test_user_from_None_api_key_is_anonymous(self):
     self.make_participant('alice')
     self.make_participant('bob')
     user = User.from_api_key(None)
     assert user.ANON
Exemplo n.º 3
0
 def test_admin_user_is_admin(self):
     self.make_participant('alice', is_admin=True)
     alice = User.from_id('alice')
     assert alice.ADMIN
Exemplo n.º 4
0
 def test_user_from_bad_id_is_anonymous(self):
     user = User.from_id('deadbeef')
     assert user.ANON
Exemplo n.º 5
0
 def test_suspicious_user_from_username_is_anonymous(self):
     self.make_participant('alice', is_suspicious=True)
     user = User.from_username('alice')
     assert user.ANON
Exemplo n.º 6
0
 def test_anonymous_user_is_not_admin(self):
     user = User()
     assert not user.ADMIN
Exemplo n.º 7
0
 def test_user_from_None_token_is_anonymous(self):
     self.make_participant("alice")
     self.make_participant("bob")
     user = User.from_session_token(None)
     assert user.ANON
Exemplo n.º 8
0
 def test_user_can_be_loaded_from_api_key(self):
     alice = self.make_participant('alice')
     api_key = alice.recreate_api_key()
     actual = User.from_api_key(api_key).username
     assert actual == 'alice', actual
Exemplo n.º 9
0
 def test_username_is_case_insensitive(self):
     self.make_participant('AlIcE')
     actual = User.from_username('aLiCe').username_lower
     assert actual == 'alice', actual
Exemplo n.º 10
0
 def test_known_user_is_known(self):
     self.make_participant("alice")
     alice = User.from_id("alice")
     assert not alice.ANON
Exemplo n.º 11
0
 def test_known_user_is_known(self):
     self.make_participant('alice')
     alice = User.from_username('alice')
     assert not alice.ANON
Exemplo n.º 12
0
 def test_known_user_is_known(self):
     self.make_participant('alice')
     alice = User.from_id('alice')
     assert not alice.ANON
Exemplo n.º 13
0
 def test_user_can_be_loaded_from_api_key(self):
     alice = self.make_participant('alice')
     api_key = alice.recreate_api_key()
     actual = User.from_api_key(api_key).username
     assert actual == 'alice', actual
Exemplo n.º 14
0
 def test_user_from_bad_api_key_is_anonymous(self):
     user = User.from_api_key('deadbeef')
     assert user.ANON
Exemplo n.º 15
0
 def test_username_is_case_insensitive(self):
     self.make_participant('AlIcE')
     actual = User.from_username('aLiCe').username_lower
     assert actual == 'alice', actual
Exemplo n.º 16
0
 def test_user_from_None_api_key_is_anonymous(self):
     self.make_participant('alice')
     self.make_participant('bob')
     user = User.from_api_key(None)
     assert user.ANON
Exemplo n.º 17
0
 def test_known_user_is_not_admin(self):
     self.make_participant('alice')
     alice = User.from_username('alice')
     assert not alice.ADMIN
Exemplo n.º 18
0
 def test_user_from_bad_id_is_anonymous(self):
     user = User.from_username('deadbeef')
     assert user.ANON
Exemplo n.º 19
0
 def test_admin_user_is_admin(self):
     self.make_participant('alice', is_admin=True)
     alice = User.from_username('alice')
     assert alice.ADMIN
Exemplo n.º 20
0
 def test_signed_out_user_is_anonymous(self):
     self.make_participant('alice')
     alice = User.from_username('alice')
     assert not alice.ANON
     alice = alice.sign_out()
     assert alice.ANON
Exemplo n.º 21
0
 def test_user_from_bad_session_token_is_anonymous(self):
     user = User.from_session_token('deadbeef')
     assert user.ANON
Exemplo n.º 22
0
 def test_known_user_is_not_admin(self):
     self.make_participant('alice')
     alice = User.from_id('alice')
     assert not alice.ADMIN
Exemplo n.º 23
0
 def test_user_from_None_session_token_is_anonymous(self):
     self.make_participant('alice')
     self.make_participant('bob')
     user = User.from_session_token(None)
     assert user.ANON
Exemplo n.º 24
0
 def test_user_from_bad_token_is_anonymous(self):
     user = User.from_session_token('deadbeef')
     assert user.ANON
Exemplo n.º 25
0
 def test_user_can_be_loaded_from_session_token(self):
     self.make_participant('alice')
     token = User.from_username('alice').session_token
     actual = User.from_session_token(token).username
     assert actual == 'alice', actual
Exemplo n.º 26
0
 def test_suspicious_user_from_id_is_anonymous(self):
     self.make_participant('alice', is_suspicious=True)
     user = User.from_id('alice')
     assert user.ANON
Exemplo n.º 27
0
 def test_anonymous_user_is_anonymous(self):
     user = User()
     assert user.ANON
Exemplo n.º 28
0
 def test_signed_out_user_is_anonymous(self):
     self.make_participant('alice')
     alice = User.from_id('alice')
     assert not alice.ANON
     alice = alice.sign_out()
     assert alice.ANON
Exemplo n.º 29
0
 def test_user_from_bad_api_key_is_anonymous(self):
     user = User.from_api_key('deadbeef')
     assert user.ANON