Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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))
Esempio n. 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)