From c3a3aa15e32d834be1699bcaccdf0a7af8bebf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Tue, 7 Nov 2023 15:09:07 +0200 Subject: [PATCH] Remove references to info.immutable This field no longer exists. The test checking this field was also removed. --- .../subscription_status_model.dart | 25 ++++++++----------- .../test/core/agent_api_client_test.dart | 3 --- .../subscription_status_model_test.dart | 10 -------- .../subscription_status_page_test.dart | 4 --- 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_model.dart b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_model.dart index fea939ac5..1b14b8178 100644 --- a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_model.dart +++ b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_model.dart @@ -15,21 +15,18 @@ sealed class SubscriptionStatusModel { SubscriptionInfo info, AgentApiClient client, ) { - if (!info.immutable) { - switch (info.whichSubscriptionType()) { - case SubscriptionType.organization: - return OrgSubscriptionStatusModel(); - case SubscriptionType.user: - return UserSubscriptionStatusModel(client); - case SubscriptionType.microsoftStore: - return StoreSubscriptionStatusModel(info.productId); - case SubscriptionType.none: - return SubscribeNowModel(client); - case SubscriptionType.notSet: - throw UnimplementedError('Unknown subscription type'); - } + switch (info.whichSubscriptionType()) { + case SubscriptionType.organization: + return OrgSubscriptionStatusModel(); + case SubscriptionType.user: + return UserSubscriptionStatusModel(client); + case SubscriptionType.microsoftStore: + return StoreSubscriptionStatusModel(info.productId); + case SubscriptionType.none: + return SubscribeNowModel(client); + case SubscriptionType.notSet: + throw UnimplementedError('Unknown subscription type'); } - return OrgSubscriptionStatusModel(); } SubscriptionStatusModel._(); } diff --git a/gui/packages/ubuntupro/test/core/agent_api_client_test.dart b/gui/packages/ubuntupro/test/core/agent_api_client_test.dart index 6734b9093..b363a24f2 100644 --- a/gui/packages/ubuntupro/test/core/agent_api_client_test.dart +++ b/gui/packages/ubuntupro/test/core/agent_api_client_test.dart @@ -21,7 +21,6 @@ void main() { test('no subscription info', () async { final info = await client.subscriptionInfo(); expect(info.productId, isEmpty); - expect(info.immutable, isFalse); expect(info.whichSubscriptionType(), SubscriptionType.none); }); test('pro attach user subscription', () async { @@ -29,7 +28,6 @@ void main() { final info = await client.subscriptionInfo(); expect(info.productId, isEmpty); - expect(info.immutable, isFalse); expect(info.whichSubscriptionType(), SubscriptionType.user); }); @@ -38,7 +36,6 @@ void main() { final info = await client.subscriptionInfo(); expect(info.productId, isEmpty); - expect(info.immutable, isFalse); expect(info.whichSubscriptionType(), SubscriptionType.none); }); }); diff --git a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_model_test.dart b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_model_test.dart index af164fa7c..ba8fb85e2 100644 --- a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_model_test.dart +++ b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_model_test.dart @@ -19,15 +19,8 @@ void main() { final info = SubscriptionInfo(); info.productId = 'my prod ID'; - test('immutable is org', () async { - info.immutable = true; - final model = SubscriptionStatusModel(info, client); - expect(model.runtimeType, OrgSubscriptionStatusModel); - }); - test('none subscribes now', () async { info.ensureNone(); - info.immutable = false; final model = SubscriptionStatusModel(info, client); expect(model.runtimeType, SubscribeNowModel); }); @@ -42,7 +35,6 @@ void main() { }); test('store', () async { info.ensureMicrosoftStore(); - info.immutable = false; final model = SubscriptionStatusModel(info, client); expect(model.runtimeType, StoreSubscriptionStatusModel); @@ -50,7 +42,6 @@ void main() { test('user', () async { info.ensureUser(); - info.immutable = false; final model = SubscriptionStatusModel(info, client); expect(model.runtimeType, UserSubscriptionStatusModel); @@ -58,7 +49,6 @@ void main() { test('organization', () async { info.ensureOrganization(); - info.immutable = false; final model = SubscriptionStatusModel(info, client); expect(model.runtimeType, OrgSubscriptionStatusModel); diff --git a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart index f13d87352..0c7f4b1d0 100644 --- a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart +++ b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart @@ -14,7 +14,6 @@ void main() { final info = SubscriptionInfo(); testWidgets('user', (tester) async { info.ensureUser(); - info.immutable = false; final app = buildApp(info, client); await tester.pumpWidget(app); @@ -27,7 +26,6 @@ void main() { testWidgets('store', (tester) async { info.ensureMicrosoftStore(); - info.immutable = false; final app = buildApp(info, client); await tester.pumpWidget(app); @@ -40,7 +38,6 @@ void main() { testWidgets('organization', (tester) async { info.ensureOrganization(); - info.immutable = false; final app = buildApp(info, client); await tester.pumpWidget(app); @@ -55,7 +52,6 @@ void main() { final mockClient = FakeAgentApiClient(); final info = ValueNotifier(SubscriptionInfo()); info.value.ensureUser(); - info.value.immutable = false; registerServiceInstance(mockClient); final app = ChangeNotifierProvider.value( value: info,