Пример #1
0
    def test_region_blacklist(self, get_region_cached_mock):
        from softwarecenter.region import REGION_BLACKLIST_TAG

        get_region_cached_mock.return_value = {"countrycode": "es"}
        app_dict = make_software_center_agent_app_dict()
        app_dict["debtags"] = ["%s%s" % (REGION_BLACKLIST_TAG, "es")]
        # see _get_app_details_from_app_dict
        item = PistonResponseObject.from_dict(app_dict)
        parser = SCAApplicationParser(item)
        doc = make_doc_from_parser(parser, self.db._aptcache)
        self.assertEqual(doc, None)
 def test_region_blacklist(self, get_region_cached_mock):
     from softwarecenter.region import REGION_BLACKLIST_TAG
     get_region_cached_mock.return_value = {
         "countrycode": "es",
     }
     app_dict = make_software_center_agent_app_dict()
     app_dict["debtags"] = [
         "%s%s" % (REGION_BLACKLIST_TAG, "es"),
     ]
     # see _get_app_details_from_app_dict
     item = PistonResponseObject.from_dict(app_dict)
     parser = SCAApplicationParser(item)
     doc = make_doc_from_parser(parser, self.db._aptcache)
     self.assertEqual(doc, None)
 def test_region_whitelist_blacklists(self, get_region_cached_mock):
     """Test that the whitelist ignores non-whitelist locations"""
     from softwarecenter.region import REGION_WHITELIST_TAG
     get_region_cached_mock.return_value = {
         "countrycode": "de",
     }
     app_dict = make_software_center_agent_app_dict()
     app_dict["debtags"] = [
         "%s%s" % (REGION_WHITELIST_TAG, "ES"),
     ]
     # see _get_app_details_from_app_dict
     item = PistonResponseObject.from_dict(app_dict)
     parser = SCAApplicationParser(item)
     doc = make_doc_from_parser(parser, self.db._aptcache)
     self.assertEqual(doc, None)
Пример #4
0
def make_purchased_app_details(db=None, supported_series=None):
    """Return an AppDetail instance with the required attributes."""
    app = make_software_center_agent_app_dict()
    subscription = make_software_center_agent_subscription_dict(app)

    if supported_series != None:
        subscription["application"]["series"] = supported_series
    else:
        # If no supportod_series kwarg was provided, we ensure the
        # current series/arch is supported.
        distro = get_distro()
        subscription["application"]["series"] = {distro.get_codename(): [distro.get_architecture()]}

    item = PistonResponseObject.from_dict(subscription)
    parser = SCAPurchasedApplicationParser(item)

    if db is None:
        db = get_test_db()

    doc = make_doc_from_parser(parser, db._aptcache)
    app_details = AppDetails(db, doc)
    return app_details
def make_purchased_app_details(db=None, supported_series=None):
    """Return an AppDetail instance with the required attributes."""
    app = make_software_center_agent_app_dict()
    subscription = make_software_center_agent_subscription_dict(app)

    if supported_series != None:
        subscription['application']['series'] = supported_series
    else:
        # If no supportod_series kwarg was provided, we ensure the
        # current series/arch is supported.
        distro = get_distro()
        subscription['application']['series'] = {
            distro.get_codename(): [distro.get_architecture()]
        }

    item = PistonResponseObject.from_dict(subscription)
    parser = SCAPurchasedApplicationParser(item)

    if db is None:
        db = get_test_db()

    doc = make_doc_from_parser(parser, db._aptcache)
    app_details = AppDetails(db, doc)
    return app_details
Пример #6
0
 def _get_app_details_from_app_dict(self, app_dict):
     item = PistonResponseObject.from_dict(app_dict)
     parser = SCAApplicationParser(item)
     doc = make_doc_from_parser(parser, self.db._aptcache)
     app_details = AppDetails(self.db, doc)
     return app_details
 def _get_app_details_from_app_dict(self, app_dict):
     item = PistonResponseObject.from_dict(app_dict)
     parser = SCAApplicationParser(item)
     doc = make_doc_from_parser(parser, self.db._aptcache)
     app_details = AppDetails(self.db, doc)
     return app_details