Example #1
0
    def test_update_user_with_known_user_performs_update(self):
        repo = UserRepo(TEST_SESSION_FACTORY)
        u = User(username="******",
                 email="good@somewhere",
                 admin=False,
                 provider=AuthProvider.google,
                 active=False)
        repo.add_user(u)

        u_pre_change_actual = repo.get_by_username("goodusername",
                                                   AuthProvider.google)
        self.assertEqual(u, u_pre_change_actual)

        u_activated = User(username="******",
                           email="good@somewhere",
                           provider=AuthProvider.google,
                           admin=False,
                           active=True)
        repo.update_user(u_activated)

        u_actual = repo.get_by_username("goodusername", AuthProvider.google)
        self.assertEqual(u_activated, u_actual)
Example #2
0
 def test_update_user_with_unknown_user_raises_lookuperror(self):
     repo = UserRepo(TEST_SESSION_FACTORY)
     u = User(username="******", email="good@somewhere")
     with self.assertRaises(LookupError):
         repo.update_user(u)