Example #1
0
 def test_enable_with_users_to_spare(self):
     context = WhichContext()
     context.availability = self.availability
     context.functionality = self.functionality
     context.enabled_count = 5
     availability = enable_availability_by_user_count(context)
     self.assertEqual(availability, self.availability)
Example #2
0
 def test_already_enabled(self):
     context = WhichContext()
     context.availability = Availability(is_enabled=True)
     context.functionality = Functionality()
     context.functionality.availability = context.availability
     availability = enable_availability_by_user_count(context)
     self.assertEqual(availability, context.availability)
Example #3
0
 def test_get_availability(self):
     context = WhichContext()
     context.client_user = self.user
     context.functionality = self.functionality
     get_availability(context)
     self.assertIsNotNone(context.availability)
     self.assertEqual(context.availability, self.availability)
Example #4
0
    def test_with_no_flavors_present(self):
        context = WhichContext()
        context.functionality = Functionality()

        from core.functionality import NoAvailability
        with self.assertRaises(NoAvailability):
            assert_existence_of_flavors(context)
Example #5
0
    def test_with_flavors_present(self):
        company = Company(name='Testcompany')
        company.save()
        app = App(name='Test App', slug='test-app', company=company)
        app.save()
        self.functionality = Functionality(app=app, name='Test Func', slug='test-func',
                                           rollout_strategy=Functionality.DEFINED_BY_RELEASES)
        self.functionality.save()
        flavor = Flavor(name='Flav', slug='flav', functionality=self.functionality)
        flavor.save()

        context = WhichContext()
        context.functionality = self.functionality
        self.assertIsNone(assert_existence_of_flavors(context))
Example #6
0
 def test_wrong_roll_out_strategy(self):
     context = WhichContext()
     context.availability = Availability(is_enabled=False)
     context.functionality = Functionality(rollout_strategy=Functionality.RECALL_FUNCTIONALITY)
     availability = enable_availability_by_user_count(context)
     self.assertIsNone(availability)
Example #7
0
 def test_enabled(self):
     context = WhichContext()
     context.availability = Availability(is_enabled=True)
     self.assertEqual(check_for_existing_enabled_availability(context), context.availability)
Example #8
0
 def test_not_enabled(self):
     context = WhichContext()
     context.availability = Availability(is_enabled=False)
     self.assertIsNone(check_for_existing_enabled_availability(context))