Beispiel #1
0
 def test_user_from_browserid(self):
     user = User.from_browserid({
         'email': '*****@*****.**',
         'issuer': 'pudo.org'
     })
     assert user is not None, user
     assert User.objects.count() == 1, User.objects.all()
Beispiel #2
0
    def test_user_session(self):
        user = User.from_browserid({"email": "*****@*****.**", "issuer": "pudo.org"})

        data = json.loads(self.app.get("/api/1/sessions").get_data())
        assert not data.get("logged_in"), data

        with self.app.session_transaction() as sess:
            sess["user_id"] = user.email
            sess["_fresh"] = True

        data = json.loads(self.app.get("/api/1/sessions").get_data())
        assert data.get("logged_in"), data
        assert data.get("user").get("email") == user.email
Beispiel #3
0
    def test_user_session(self):
        user = User.from_browserid({
            'email': '*****@*****.**',
            'issuer': 'pudo.org'
        })

        data = json.loads(self.app.get('/api/1/sessions').get_data())
        assert not data.get('logged_in'), data

        with self.app.session_transaction() as sess:
            sess['user_id'] = user.email
            sess['_fresh'] = True

        data = json.loads(self.app.get('/api/1/sessions').get_data())
        assert data.get('logged_in'), data
        assert data.get('user').get('email') == user.email
Beispiel #4
0
def get(id):
    user = obj_or_404(User.by_id(id))
    #require.service.view(service)
    return jsonify(user)
Beispiel #5
0
 def test_user_from_browserid(self):
     user = User.from_browserid({"email": "*****@*****.**", "issuer": "pudo.org"})
     assert user is not None, user
     assert User.objects.count() == 1, User.objects.all()
Beispiel #6
0
def get(id):
    user = obj_or_404(User.by_id(id))
    #require.service.view(service)
    return jsonify(user)