Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: SP refactor #3733

Open
wants to merge 50 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e898638
Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into rl
MilosKozak Dec 16, 2024
9247767
RL -> kt
MilosKozak Dec 16, 2024
90e7e81
SP -> Preferences #1
MilosKozak Jan 10, 2025
d3d9215
SP -> Preferences #2
MilosKozak Jan 10, 2025
1da1a2d
SP -> Preferences #3
MilosKozak Jan 11, 2025
078ae35
SP -> Preferences #4
MilosKozak Jan 11, 2025
ca6d514
SP -> Preferences #5
MilosKozak Jan 11, 2025
76ec1e0
SP -> Preferences #6
MilosKozak Jan 11, 2025
42a383c
SP -> Preferences #7
MilosKozak Jan 11, 2025
c9c466e
SP -> Preferences #8
MilosKozak Jan 11, 2025
4445d4e
SP -> Preferences #9
MilosKozak Jan 12, 2025
485bdd0
SP -> Preferences #10
MilosKozak Jan 12, 2025
cadd391
Merge branch 'dev' into sprefactor
MilosKozak Jan 13, 2025
5fb825a
SP -> Preferences #10
MilosKozak Jan 14, 2025
fa16fed
Merge remote-tracking branch 'origin/dev' into sprefactor
MilosKozak Jan 14, 2025
3e4b97b
Merge branch 'dev' into sprefactor
MilosKozak Jan 15, 2025
1d617b8
Merge branch 'dev' into rl
MilosKozak Jan 17, 2025
a5b3318
RL: resolve nullability
MilosKozak Jan 17, 2025
9b7938c
RL: kotlin cleanup
MilosKozak Jan 19, 2025
f04dc20
Merge branch 'dev' into sprefactor
MilosKozak Jan 20, 2025
f798220
fix tests
MilosKozak Jan 20, 2025
8fe7feb
Merge branch 'rl' into sprefactor
MilosKozak Jan 21, 2025
ebb4994
Medtronic,RL: migrate preferences
MilosKozak Jan 21, 2025
2b738f1
SP -> Preferences #12
MilosKozak Jan 22, 2025
3256617
SP -> Preferences #13
MilosKozak Jan 22, 2025
ab1f604
Cleanup
MilosKozak Jan 22, 2025
70237e1
Merge remote-tracking branch 'origin/dev' into sprefactor
MilosKozak Jan 22, 2025
4928192
Dash: preferences -> Key
MilosKozak Jan 23, 2025
00459ed
MDT: fix keys (inc)
MilosKozak Jan 23, 2025
dc535d3
Merge branch 'sprefactor' of https://github.com/nightscout/AndroidAPS…
MilosKozak Jan 23, 2025
4912e04
Merge remote-tracking branch 'origin/dev' into sprefactor
MilosKozak Jan 23, 2025
335781f
OmnipodErosPumpPlugin -> kt
MilosKozak Jan 24, 2025
0f50816
Merge remote-tracking branch 'origin/dev' into sprefactor
MilosKozak Jan 29, 2025
8cb5a45
Merge remote-tracking branch 'origin/dev' into sprefactor
MilosKozak Feb 8, 2025
23fb7df
SP -> Preferences #14
MilosKozak Feb 8, 2025
656a3d2
Merge remote-tracking branch 'origin/dev' into sprefactor
MilosKozak Feb 8, 2025
08c268e
SP -> Preferences #15
MilosKozak Feb 8, 2025
8686804
fix tests
MilosKozak Feb 9, 2025
cc90ed9
remove unused files
MilosKozak Feb 9, 2025
57f838b
SP -> Preferences #16
MilosKozak Feb 9, 2025
a309471
SP -> Preferences #17
MilosKozak Feb 9, 2025
dab13ce
SP -> Preferences #18
MilosKozak Feb 9, 2025
f72c587
SP -> Preferences #19
MilosKozak Feb 9, 2025
e98b0c6
SP -> Preferences #20
MilosKozak Feb 9, 2025
be64ae9
SP -> Preferences #21
MilosKozak Feb 9, 2025
7ebdc1d
SP -> Preferences #22
MilosKozak Feb 9, 2025
9f6f9af
SP -> Preferences #23
MilosKozak Feb 9, 2025
e483660
SP -> Preferences #24
MilosKozak Feb 10, 2025
496064e
SP -> Preferences #25
MilosKozak Feb 10, 2025
d3e9cb0
fix tests
MilosKozak Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
MilosKozak committed Jan 20, 2025
commit f7982201b81256b90de350d77de6e19ae4964886
Original file line number Diff line number Diff line change
@@ -11,17 +11,17 @@ class ExportPasswordDataStoreImplTest : TestBaseWithProfile() {
private val somePassword = "somePassword"

val sut: ExportPasswordDataStoreImpl by lazy {
ExportPasswordDataStoreImpl(aapsLogger, sp, config)
ExportPasswordDataStoreImpl(aapsLogger, preferences, config)
}

@Test
fun exportPasswordStoreEnabled() {
// When disabled
`when`(sp.getBoolean(BooleanKey.MaintenanceEnableExportSettingsAutomation.key, false)).thenReturn(false)
`when`(preferences.get(BooleanKey.MaintenanceEnableExportSettingsAutomation)).thenReturn(false)
assertFalse(sut.exportPasswordStoreEnabled())

// When enabled
`when`(sp.getBoolean(BooleanKey.MaintenanceEnableExportSettingsAutomation.key, false)).thenReturn(true)
`when`(preferences.get(BooleanKey.MaintenanceEnableExportSettingsAutomation)).thenReturn(true)
assertTrue(sut.exportPasswordStoreEnabled())
assertTrue(sut.clearPasswordDataStore(context).isEmpty())

@@ -32,19 +32,19 @@ class ExportPasswordDataStoreImplTest : TestBaseWithProfile() {

@Test
fun clearPasswordDataStore() {
`when`(sp.getBoolean(BooleanKey.MaintenanceEnableExportSettingsAutomation.key, false)).thenReturn(false)
`when`(preferences.get(BooleanKey.MaintenanceEnableExportSettingsAutomation)).thenReturn(false)
assertTrue(sut.clearPasswordDataStore(context).isEmpty())
}

@Test
fun putPasswordToDataStore() {
`when`(sp.getBoolean(BooleanKey.MaintenanceEnableExportSettingsAutomation.key, false)).thenReturn(false)
`when`(preferences.get(BooleanKey.MaintenanceEnableExportSettingsAutomation)).thenReturn(false)
assertTrue(sut.putPasswordToDataStore(context, somePassword) == somePassword)
}

@Test
fun getPasswordFromDataStore() {
`when`(sp.getBoolean(BooleanKey.MaintenanceEnableExportSettingsAutomation.key, false)).thenReturn(false)
`when`(preferences.get(BooleanKey.MaintenanceEnableExportSettingsAutomation)).thenReturn(false)
assertTrue(sut.getPasswordFromDataStore(context) == Triple("", true, true))
}
}
Original file line number Diff line number Diff line change
@@ -48,7 +48,6 @@ class QueueWorkerTest : TestBaseWithProfile() {
it.rxBus = rxBus
it.activePlugin = activePlugin
it.rh = rh
it.sp = sp
it.preferences = preferences
it.androidPermission = androidPermission
it.config = config
@@ -63,7 +62,7 @@ class QueueWorkerTest : TestBaseWithProfile() {
fun prepare() {
commandQueue = CommandQueueImplementation(
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
profileFunction, activePlugin, context, sp, preferences, config, dateUtil, fabricPrivacy, androidPermission,
profileFunction, activePlugin, context, preferences, config, dateUtil, fabricPrivacy, androidPermission,
uiInteraction, persistenceLayer, decimalFormatter, instantiator, jobName, workManager
)