Skip to content

Commit

Permalink
Enable the 'Is Active?' flag by default in user view (#37507)
Browse files Browse the repository at this point in the history
* Enable the 'Is Active?' flag by default in user view

* fixing tests
  • Loading branch information
amoghrajesh committed Feb 17, 2024
1 parent d50a25b commit 68e20aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion airflow/providers/fab/auth_manager/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class User(Model, BaseUser):
String(512).with_variant(String(512, collation="NOCASE"), "sqlite"), unique=True, nullable=False
)
password = Column(String(256))
active = Column(Boolean)
active = Column(Boolean, default=True)
email = Column(String(512), unique=True, nullable=False)
last_login = Column(DateTime)
login_count = Column(Integer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def _create_users(self, count, roles=None):
roles=roles or [],
created_on=timezone.parse(DEFAULT_TIME),
changed_on=timezone.parse(DEFAULT_TIME),
active=True,
)
for i in range(1, count + 1)
]
Expand All @@ -96,7 +97,7 @@ def test_should_respond_200(self):
response = self.client.get("/auth/fab/v1/users/TEST_USER1", environ_overrides={"REMOTE_USER": "test"})
assert response.status_code == 200
assert response.json == {
"active": None,
"active": True,
"changed_on": DEFAULT_TIME,
"created_on": DEFAULT_TIME,
"email": "mytest@test1.org",
Expand Down Expand Up @@ -124,7 +125,7 @@ def test_last_names_can_be_empty(self):
response = self.client.get("/auth/fab/v1/users/prince", environ_overrides={"REMOTE_USER": "test"})
assert response.status_code == 200
assert response.json == {
"active": None,
"active": True,
"changed_on": DEFAULT_TIME,
"created_on": DEFAULT_TIME,
"email": "prince@example.org",
Expand Down Expand Up @@ -152,7 +153,7 @@ def test_first_names_can_be_empty(self):
response = self.client.get("/auth/fab/v1/users/liberace", environ_overrides={"REMOTE_USER": "test"})
assert response.status_code == 200
assert response.json == {
"active": None,
"active": True,
"changed_on": DEFAULT_TIME,
"created_on": DEFAULT_TIME,
"email": "liberace@example.org",
Expand Down Expand Up @@ -180,7 +181,7 @@ def test_both_first_and_last_names_can_be_empty(self):
response = self.client.get("/auth/fab/v1/users/nameless", environ_overrides={"REMOTE_USER": "test"})
assert response.status_code == 200
assert response.json == {
"active": None,
"active": True,
"changed_on": DEFAULT_TIME,
"created_on": DEFAULT_TIME,
"email": "nameless@example.org",
Expand Down

0 comments on commit 68e20aa

Please sign in to comment.