Beispiel #1
0
    def set_app_version_config(self):
        """ Creates configuration data for platform versions """
        AppVersionConfig(platform="iOS",
                         version="1.1.1",
                         expire_at=None,
                         enabled=True).save()
        AppVersionConfig(platform="iOS",
                         version="2.2.2",
                         expire_at=datetime(2014, 1, 1, tzinfo=UTC),
                         enabled=True).save()
        AppVersionConfig(platform="iOS",
                         version="4.4.4",
                         expire_at=datetime(9000, 1, 1, tzinfo=UTC),
                         enabled=True).save()
        AppVersionConfig(platform="iOS",
                         version="6.6.6",
                         expire_at=None,
                         enabled=True).save()

        AppVersionConfig(platform="Android",
                         version="1.1.1",
                         expire_at=None,
                         enabled=True).save()
        AppVersionConfig(platform="Android",
                         version="2.2.2",
                         expire_at=datetime(2014, 1, 1, tzinfo=UTC),
                         enabled=True).save()
        AppVersionConfig(platform="Android",
                         version="4.4.4",
                         expire_at=datetime(5000, 1, 1, tzinfo=UTC),
                         enabled=True).save()
        AppVersionConfig(platform="Android",
                         version="8.8.8",
                         expire_at=None,
                         enabled=True).save()
Beispiel #2
0
 def test_last_supported_date(self, platform, version, last_supported_date):
     self.set_app_version_config()
     assert last_supported_date == AppVersionConfig.last_supported_date(
         platform, version)
Beispiel #3
0
 def test_latest_version(self, platform, latest_version):
     self.set_app_version_config()
     assert latest_version == AppVersionConfig.latest_version(platform)
Beispiel #4
0
 def test_no_configs_available(self, platform, version):
     assert AppVersionConfig.latest_version(platform) is None
     assert AppVersionConfig.last_supported_date(platform, version) is None
Beispiel #5
0
 def _get_latest_version(self, platform_name):
     """ Get latest app version available for platform. """
     return AppVersionConfig.latest_version(
         platform_name) or self.NO_LATEST_VERSION
Beispiel #6
0
 def _get_last_supported_date(self, platform_name, platform_version):
     """ Get expiry date of app version for a platform. """
     return AppVersionConfig.last_supported_date(
         platform_name, platform_version) or self.NO_LAST_SUPPORTED_DATE
Beispiel #7
0
 def test_last_supported_date(self, platform, version, last_supported_date):
     self.set_app_version_config()
     self.assertEqual(
         last_supported_date,
         AppVersionConfig.last_supported_date(platform, version))
Beispiel #8
0
 def test_latest_version(self, platform, latest_version):
     self.set_app_version_config()
     self.assertEqual(latest_version,
                      AppVersionConfig.latest_version(platform))
Beispiel #9
0
 def test_no_configs_available(self, platform, version):
     self.assertIsNone(AppVersionConfig.latest_version(platform))
     self.assertIsNone(
         AppVersionConfig.last_supported_date(platform, version))