Ejemplo n.º 1
0
    def test_go_trough_all_combo_options(self):
        # Traverse countries
        for country in self.countries:
            # Check if country is stored
            self.db.set_country(country.idx)
            new_country = self.db.get_country()
            self.assertEqual(country.code, new_country.code)

            # Traverse providers for country
            providers = self.db.get_providers()
            for provider in providers:
                # Check if provider is stored
                self.db.set_provider(provider.idx)
                new_provider = self.db.get_provider()
                self.assertEqual(provider.name, new_provider.name)

                # Traverse plans for provider
                plans = self.db.get_plans()
                for plan in plans:
                    # Check if plan is stored
                    self.db.set_plan(plan.idx)
                    new_plan = self.db.get_plan()
                    self.assertEqual(plan.name, new_plan.name)

                    # Check if selection is permanently stored
                    db2 = ServiceProviders()
                    country2 = db2.get_country()
                    provider2 = db2.get_provider()
                    plan2 = db2.get_plan()
                    self.assertEqual(country2.idx, country.idx)
                    self.assertEqual(provider2.idx, provider.idx)
                    self.assertEqual(plan2.idx, plan.idx)
Ejemplo n.º 2
0
    def test_go_trough_all_combo_options(self):
        # Traverse countries
        for country in self.countries:
            # Check if country is stored
            self.db.set_country(country.idx)
            new_country = self.db.get_country()
            self.assertEqual(country.code, new_country.code)

            # Traverse providers for country
            providers = self.db.get_providers()
            for provider in providers:
                # Check if provider is stored
                self.db.set_provider(provider.idx)
                new_provider = self.db.get_provider()
                self.assertEqual(provider.name, new_provider.name)

                # Traverse plans for provider
                plans = self.db.get_plans()
                for plan in plans:
                    # Check if plan is stored
                    self.db.set_plan(plan.idx)
                    new_plan = self.db.get_plan()
                    self.assertEqual(plan.name, new_plan.name)

                    # Check if selection is permanently stored
                    db2 = ServiceProviders()
                    country2 = db2.get_country()
                    provider2 = db2.get_provider()
                    plan2 = db2.get_plan()
                    self.assertEqual(country2.idx, country.idx)
                    self.assertEqual(provider2.idx, provider.idx)
                    self.assertEqual(plan2.idx, plan.idx)
Ejemplo n.º 3
0
    def test_guess_country(self):
        LOCALE = ('hi_IN', 'UTF-8')
        default_country_code = LOCALE[0][3:5].lower()

        with patch('locale.getdefaultlocale') as locale_mock:
            locale_mock.return_value = LOCALE

            db = ServiceProviders()
            country = db.get_country()
            self.assertEqual(country.code, default_country_code)
Ejemplo n.º 4
0
    def test_guess_country(self):
        LOCALE = ('hi_IN', 'UTF-8')
        default_country_code = LOCALE[0][3:5].lower()

        with patch('locale.getdefaultlocale') as locale_mock:
            locale_mock.return_value = LOCALE

            db = ServiceProviders()
            country = db.get_country()
            self.assertEqual(country.code, default_country_code)
Ejemplo n.º 5
0
 def setUp(self):
     self.db = ServiceProviders()
     self.countries = self.db.get_countries()
Ejemplo n.º 6
0
 def setUp(self):
     self.db = ServiceProviders()
     self.countries = self.db.get_countries()
Ejemplo n.º 7
0
 def setUp(self):
     from cpsection.modemconfiguration.model import ServiceProviders
     self.db = ServiceProviders()
     self.countries = self.db.get_countries()
Ejemplo n.º 8
0
class ServiceProvidersTest(unittest.TestCase):
    def setUp(self):
        from cpsection.modemconfiguration.model import ServiceProviders
        self.db = ServiceProviders()
        self.countries = self.db.get_countries()

    def test_go_trough_all_combo_options(self):
        from cpsection.modemconfiguration.model import ServiceProviders
        # Traverse countries
        for country in self.countries:
            # Check if country is stored
            self.db.set_country(country.idx)
            new_country = self.db.get_country()
            self.assertEqual(country.code, new_country.code)

            # Traverse providers for country
            providers = self.db.get_providers()
            for provider in providers:
                # Check if provider is stored
                self.db.set_provider(provider.idx)
                new_provider = self.db.get_provider()
                self.assertEqual(provider.name, new_provider.name)

                # Traverse plans for provider
                plans = self.db.get_plans()
                for plan in plans:
                    # Check if plan is stored
                    self.db.set_plan(plan.idx)
                    new_plan = self.db.get_plan()
                    self.assertEqual(plan.name, new_plan.name)

                    # Check if selection is permanently stored
                    db2 = ServiceProviders()
                    country2 = db2.get_country()
                    provider2 = db2.get_provider()
                    plan2 = db2.get_plan()
                    self.assertEqual(country2.idx, country.idx)
                    self.assertEqual(provider2.idx, provider.idx)
                    self.assertEqual(plan2.idx, plan.idx)