Exemplo n.º 1
0
  def test_get_user_returns_user_if_not_exists(self):
    # Setup.
    user = user_models.User(email='*****@*****.**')
    user.put()
    test_utils.mock_get_user_id(self, user.key.id())

    # Exercise.
    response = self.app.get('/api/user/me')

    # Verify
    self.assertEqual(200, response.status_code)
    user_json = json.loads(response.data)
    self.assertEqual('*****@*****.**', user_json['email'])
Exemplo n.º 2
0
  def test_delete_user_deletes_if_exists(self):
    # Setup.
    user = user_models.User.create('*****@*****.**', 'qwerty')
    user.put()
    test_utils.mock_get_user_id(self, user.key.id())

    headers = test_utils.create_basic_auth_headers()
    headers['Content-Type'] = 'application/json'

    # Exercise.
    response = self.app.delete('/api/user/', headers=headers)

    # Verify
    self.assertEqual(200, response.status_code)
    found_user = user_models.User.find_by_email('*****@*****.**')
    self.assertFalse(found_user)