{ 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', () => {
let component: SettingsComponent
let fixture: ComponentFixture<SettingsComponent>
})
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(permissionsService, 'isAdmin').mockReturnValue(true)
completeSetup()
it('should open system status dialog', () => {
const modalOpenSpy = jest.spyOn(modalService, 'open')
+ jest.spyOn(systemStatusService, 'get').mockReturnValue(of(status))
+ jest.spyOn(permissionsService, 'isAdmin').mockReturnValue(true)
completeSetup()
component.showSystemStatus()
expect(modalOpenSpy).toHaveBeenCalledWith(SystemStatusDialogComponent, {