Esempio n. 1
0
 def test_to_dict_returns_correct_values(self):
     # when
     user = User('*****@*****.**', '12345')
     # then
     self.assertEqual(
         {
             'email': '*****@*****.**',
             'hashed_password': '******',
             'is_admin': False,
             'id': None,
             'tasks': []
         }, user.to_dict())
Esempio n. 2
0
 def test_to_dict_all_fields_returns_correct_values(self):
     # when
     user = User('*****@*****.**', '12345')
     # then
     self.assertEqual(
         {
             'email': '*****@*****.**',
             'hashed_password': '******',
             'is_admin': False,
             'id': None,
             'tasks': []
         },
         user.to_dict({
             user.FIELD_ID, user.FIELD_EMAIL, user.FIELD_HASHED_PASSWORD,
             user.FIELD_IS_ADMIN, user.FIELD_TASKS
         }))
Esempio n. 3
0
 def test_to_dict_field_id_returns_id(self):
     # when
     user = User('*****@*****.**', '12345')
     # then
     self.assertEqual({'id': None}, user.to_dict({user.FIELD_ID}))
Esempio n. 4
0
 def test_to_dict_field_tasks_returns_tasks(self):
     # when
     user = User('*****@*****.**', '12345')
     # then
     self.assertEqual({'tasks': []}, user.to_dict({user.FIELD_TASKS}))
Esempio n. 5
0
 def test_to_dict_field_is_admin_returns_is_admin(self):
     # when
     user = User('*****@*****.**', '12345')
     # then
     self.assertEqual({'is_admin': False},
                      user.to_dict({user.FIELD_IS_ADMIN}))
Esempio n. 6
0
 def test_to_dict_field_hashed_password_returns_hashed_password(self):
     # when
     user = User('*****@*****.**', '12345')
     # then
     self.assertEqual({'hashed_password': '******'},
                      user.to_dict({user.FIELD_HASHED_PASSWORD}))
Esempio n. 7
0
 def test_to_dict_field_email_returns_email(self):
     # when
     user = User('*****@*****.**', '12345')
     # then
     self.assertEqual({'email': '*****@*****.**'},
                      user.to_dict({user.FIELD_EMAIL}))