mirror of
https://github.com/apache/superset.git
synced 2026-04-18 07:35:09 +00:00
feat(UserInfo): Migrate User Info FAB to React (#33620)
This commit is contained in:
@@ -67,6 +67,37 @@ class TestCurrentUserApi(SupersetTestCase):
|
||||
rv = self.client.get(meUri)
|
||||
assert 401 == rv.status_code
|
||||
|
||||
def test_update_me_success(self):
|
||||
self.login(ADMIN_USERNAME)
|
||||
|
||||
payload = {
|
||||
"first_name": "UpdatedFirst",
|
||||
"last_name": "UpdatedLast",
|
||||
}
|
||||
|
||||
rv = self.client.put("/api/v1/me/", json=payload)
|
||||
assert rv.status_code == 200
|
||||
|
||||
data = json.loads(rv.data.decode("utf-8"))
|
||||
assert data["result"]["first_name"] == "UpdatedFirst"
|
||||
assert data["result"]["last_name"] == "UpdatedLast"
|
||||
|
||||
def test_update_me_unauthenticated(self):
|
||||
rv = self.client.put("/api/v1/me/", json={"first_name": "Hacker"})
|
||||
assert rv.status_code == 401
|
||||
|
||||
def test_update_me_invalid_payload(self):
|
||||
self.login(ADMIN_USERNAME)
|
||||
rv = self.client.put("/api/v1/me/", json={"first_name": 123})
|
||||
assert rv.status_code == 400
|
||||
data = json.loads(rv.data.decode("utf-8"))
|
||||
assert "first_name" in data["message"]
|
||||
|
||||
def test_update_me_empty_payload(self):
|
||||
self.login(ADMIN_USERNAME)
|
||||
rv = self.client.put("/api/v1/me/", json={})
|
||||
assert rv.status_code == 400
|
||||
|
||||
|
||||
class TestUserApi(SupersetTestCase):
|
||||
def test_avatar_with_invalid_user(self):
|
||||
|
||||
Reference in New Issue
Block a user