示例#1
0
    def test_get_user_by_activation(self):
        from horus.tests.models import UserAccount
        from horus.tests.models import Activation

        user_account = UserAccount(username='******', email='*****@*****.**')
        user_account.set_password('password')
        activation = Activation()
        user_account.activation = activation

        self.session.add(user_account)
        self.session.commit()

        request = testing.DummyRequest()

        new_user_account = UserAccount.get_by_activation(request, activation)

        assert new_user_account == user_account
示例#2
0
    def test_get_user_by_activation_with_multiple_users(self):
        from horus.tests.models import UserAccount
        from horus.tests.models import Activation

        user_account1 = UserAccount(username='******', email='*****@*****.**')
        user_account2 = UserAccount(username='******', email='*****@*****.**')
        user_account1.set_password('password')
        user_account2.set_password('password2')
        activation = Activation()
        user_account2.activation = activation

        self.session.add(user_account1)
        self.session.add(user_account2)

        self.session.commit()

        request = testing.DummyRequest()

        new_user_account = UserAccount.get_by_activation(request, activation)

        assert new_user_account == user_account2