fix: address code review - Alpine.js $set, SQLAlchemy bool filter style
Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/f141cd3b-8d0a-4c7e-b479-ee973c209c11 Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -454,7 +454,7 @@ function mailSourcesApp() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async testSource(id) {
|
async testSource(id) {
|
||||||
this.$set(this.testing, id, true);
|
this.testing[id] = true;
|
||||||
this.feedback = { message: '', type: '' };
|
this.feedback = { message: '', type: '' };
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(`/api/v1/mail-sources/${id}/test`, { method: 'POST' });
|
const resp = await fetch(`/api/v1/mail-sources/${id}/test`, { method: 'POST' });
|
||||||
@@ -474,7 +474,7 @@ function mailSourcesApp() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.feedback = { message: `Test error: ${e.message}`, type: 'error' };
|
this.feedback = { message: `Test error: ${e.message}`, type: 'error' };
|
||||||
} finally {
|
} finally {
|
||||||
this.$set(this.testing, id, false);
|
this.testing[id] = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -147,9 +147,7 @@ class TestMailSourcesAPI:
|
|||||||
db_session.add(MailSource(name="Disabled", method="IMAP", enabled=False))
|
db_session.add(MailSource(name="Disabled", method="IMAP", enabled=False))
|
||||||
db_session.commit()
|
db_session.commit()
|
||||||
|
|
||||||
enabled = (
|
enabled = db_session.query(MailSource).filter(MailSource.enabled).all()
|
||||||
db_session.query(MailSource).filter(MailSource.enabled == True).all() # noqa: E712
|
|
||||||
)
|
|
||||||
assert len(enabled) == 2
|
assert len(enabled) == 2
|
||||||
names = {s.name for s in enabled}
|
names = {s.name for s in enabled}
|
||||||
assert "Enabled A" in names
|
assert "Enabled A" in names
|
||||||
|
|||||||
Reference in New Issue
Block a user