mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-06 21:13:43 -05:00
Fix error in system status test
This commit is contained in:
@@ -61,6 +61,40 @@ const groups = [
|
|||||||
{ id: 2, name: 'group2' },
|
{ id: 2, name: 'group2' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const status: SystemStatus = {
|
||||||
|
pngx_version: '2.4.3',
|
||||||
|
server_os: 'macOS-14.1.1-arm64-arm-64bit',
|
||||||
|
install_type: InstallType.BareMetal,
|
||||||
|
storage: { total: 494384795648, available: 13573525504 },
|
||||||
|
database: {
|
||||||
|
type: 'sqlite',
|
||||||
|
url: '/paperless-ngx/data/db.sqlite3',
|
||||||
|
status: SystemStatusItemStatus.ERROR,
|
||||||
|
error: null,
|
||||||
|
migration_status: {
|
||||||
|
latest_migration: 'socialaccount.0006_alter_socialaccount_extra_data',
|
||||||
|
unapplied_migrations: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tasks: {
|
||||||
|
redis_url: 'redis://localhost:6379',
|
||||||
|
redis_status: SystemStatusItemStatus.ERROR,
|
||||||
|
redis_error: 'Error 61 connecting to localhost:6379. Connection refused.',
|
||||||
|
celery_status: SystemStatusItemStatus.ERROR,
|
||||||
|
celery_url: 'celery@localhost',
|
||||||
|
celery_error: 'Error connecting to celery@localhost',
|
||||||
|
index_status: SystemStatusItemStatus.OK,
|
||||||
|
index_last_modified: new Date().toISOString(),
|
||||||
|
index_error: null,
|
||||||
|
classifier_status: SystemStatusItemStatus.OK,
|
||||||
|
classifier_last_trained: new Date().toISOString(),
|
||||||
|
classifier_error: null,
|
||||||
|
sanity_check_status: SystemStatusItemStatus.ERROR,
|
||||||
|
sanity_check_last_run: new Date().toISOString(),
|
||||||
|
sanity_check_error: 'Error running sanity check.',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('SettingsComponent', () => {
|
describe('SettingsComponent', () => {
|
||||||
let component: SettingsComponent
|
let component: SettingsComponent
|
||||||
let fixture: ComponentFixture<SettingsComponent>
|
let fixture: ComponentFixture<SettingsComponent>
|
||||||
@@ -290,40 +324,6 @@ describe('SettingsComponent', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should load system status on initialize, show errors if needed', () => {
|
it('should load system status on initialize, show errors if needed', () => {
|
||||||
const status: SystemStatus = {
|
|
||||||
pngx_version: '2.4.3',
|
|
||||||
server_os: 'macOS-14.1.1-arm64-arm-64bit',
|
|
||||||
install_type: InstallType.BareMetal,
|
|
||||||
storage: { total: 494384795648, available: 13573525504 },
|
|
||||||
database: {
|
|
||||||
type: 'sqlite',
|
|
||||||
url: '/paperless-ngx/data/db.sqlite3',
|
|
||||||
status: SystemStatusItemStatus.ERROR,
|
|
||||||
error: null,
|
|
||||||
migration_status: {
|
|
||||||
latest_migration: 'socialaccount.0006_alter_socialaccount_extra_data',
|
|
||||||
unapplied_migrations: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tasks: {
|
|
||||||
redis_url: 'redis://localhost:6379',
|
|
||||||
redis_status: SystemStatusItemStatus.ERROR,
|
|
||||||
redis_error:
|
|
||||||
'Error 61 connecting to localhost:6379. Connection refused.',
|
|
||||||
celery_status: SystemStatusItemStatus.ERROR,
|
|
||||||
celery_url: 'celery@localhost',
|
|
||||||
celery_error: 'Error connecting to celery@localhost',
|
|
||||||
index_status: SystemStatusItemStatus.OK,
|
|
||||||
index_last_modified: new Date().toISOString(),
|
|
||||||
index_error: null,
|
|
||||||
classifier_status: SystemStatusItemStatus.OK,
|
|
||||||
classifier_last_trained: new Date().toISOString(),
|
|
||||||
classifier_error: null,
|
|
||||||
sanity_check_status: SystemStatusItemStatus.ERROR,
|
|
||||||
sanity_check_last_run: new Date().toISOString(),
|
|
||||||
sanity_check_error: 'Error running sanity check.',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
jest.spyOn(systemStatusService, 'get').mockReturnValue(of(status))
|
jest.spyOn(systemStatusService, 'get').mockReturnValue(of(status))
|
||||||
jest.spyOn(permissionsService, 'isAdmin').mockReturnValue(true)
|
jest.spyOn(permissionsService, 'isAdmin').mockReturnValue(true)
|
||||||
completeSetup()
|
completeSetup()
|
||||||
@@ -340,6 +340,8 @@ describe('SettingsComponent', () => {
|
|||||||
|
|
||||||
it('should open system status dialog', () => {
|
it('should open system status dialog', () => {
|
||||||
const modalOpenSpy = jest.spyOn(modalService, 'open')
|
const modalOpenSpy = jest.spyOn(modalService, 'open')
|
||||||
|
jest.spyOn(systemStatusService, 'get').mockReturnValue(of(status))
|
||||||
|
jest.spyOn(permissionsService, 'isAdmin').mockReturnValue(true)
|
||||||
completeSetup()
|
completeSetup()
|
||||||
component.showSystemStatus()
|
component.showSystemStatus()
|
||||||
expect(modalOpenSpy).toHaveBeenCalledWith(SystemStatusDialogComponent, {
|
expect(modalOpenSpy).toHaveBeenCalledWith(SystemStatusDialogComponent, {
|
||||||
|
Reference in New Issue
Block a user