Ejemplo n.º 1
0
 def test_delete_client_cascade(self) -> None:
     """Add a new user, client, and session. Remove user to clear client and session."""
     assert User.count() == 4 and Client.count() == 4 and Session.count(
     ) == 4
     user = User.add({
         'first_name': 'James',
         'last_name': 'Bond',
         'email': '*****@*****.**',
         'alias': '007',
         'data': {
             'user_type': 'amateur',
             'drink_of_choice': 'martini'
         }
     })
     assert User.count() == 5 and Client.count() == 4 and Session.count(
     ) == 4
     Client.new(user.id)
     assert User.count() == 5 and Client.count() == 5 and Session.count(
     ) == 4
     Session.new(user.id)
     assert User.count() == 5 and Client.count() == 5 and Session.count(
     ) == 5
     User.delete(user.id)
     assert User.count() == 4 and Client.count() == 4 and Session.count(
     ) == 4
Ejemplo n.º 2
0
 def test_delete_user_cascade(self) -> None:
     """Add a new user and client record and then remove them."""
     assert User.count() == 4 and Client.count() == 4
     user = User.add({'first_name': 'James', 'last_name': 'Bond', 'email': '*****@*****.**',
                      'alias': '007', 'data': {'user_type': 'amateur', 'drink_of_choice': 'martini'}})
     assert User.count() == 5 and Client.count() == 4
     Client.new(user.id)
     assert User.count() == 5 and Client.count() == 5
     User.delete(user.id)
     assert User.count() == 4 and Client.count() == 4
Ejemplo n.º 3
0
 def test_delete(self) -> None:
     """Add a new session and remove it directly."""
     assert User.count() == 4 and Client.count() == 4 and Session.count(
     ) == 4
     user = User.add({
         'first_name': 'James',
         'last_name': 'Bond',
         'email': '*****@*****.**',
         'alias': '007',
         'data': {
             'user_type': 'amateur',
             'drink_of_choice': 'martini'
         }
     })
     assert User.count() == 5 and Client.count() == 4 and Session.count(
     ) == 4
     key, secret, client = Client.new(user.id)
     assert User.count() == 5 and Client.count() == 5 and Session.count(
     ) == 4
     Session.new(user.id)
     assert User.count() == 5 and Client.count() == 5 and Session.count(
     ) == 5
     Session.delete(Session.from_client(client.id).id)
     assert User.count() == 5 and Client.count() == 5 and Session.count(
     ) == 4
     User.delete(user.id)  # NOTE: deletes client
     assert User.count() == 4 and Client.count() == 4 and Session.count(
     ) == 4
Ejemplo n.º 4
0
 def test_delete(self) -> None:
     """Add a new user and client. Remove the client directly."""
     assert User.count() == 4 and Client.count() == 4
     user = User.add({'first_name': 'James', 'last_name': 'Bond', 'email': '*****@*****.**',
                      'alias': '007', 'data': {'user_type': 'amateur', 'drink_of_choice': 'martini'}})
     assert User.count() == 5 and Client.count() == 4
     key, secret, client = Client.new(user.id)
     assert User.count() == 5 and Client.count() == 5
     Client.delete(client.id)
     assert User.count() == 5 and Client.count() == 4
     User.delete(user.id)
     assert User.count() == 4 and Client.count() == 4