Пример #1
0
 def get(self, **kw):
     up = update.Update({
         'reqVersion': 1,
         'id': self.addon.guid,
         'version': kw.get('item_version', '1.0'),
         'appID': self.app.guid,
         'appVersion': kw.get('app_version', '3.0'),
     })
     up.cursor = connection.cursor()
     assert up.is_valid()
     up.compat_mode = kw.get('compat_mode', 'strict')
     up.get_update()
     return up.data['row'].get('version_id')
Пример #2
0
 def get(self, *args):
     up = update.Update({
         'id': self.addon.guid,
         'version': args[0],
         'appID': args[2].guid,
         'appVersion': 1,  # this is going to be overridden
         'appOS': args[3].api_name if args[3] else '',
         'reqVersion': '',
     })
     up.cursor = connection.cursor()
     assert up.is_valid()
     up.data['version_int'] = args[1]
     up.get_update()
     return (up.data['row'].get('version_id'),
             up.data['row'].get('file_id'))
Пример #3
0
 def test_unicode_data(self):
     # To trigger the error this test is trying to cover, we need 2 things:
     # - An update request that would be considered 'valid', i.e. the
     #   necessary parameters are presentTestUpdateConnectionEncoding and
     #   the add-on exists.
     # - A database cursor instantiated from the update service, not by
     #   django tests.
     # Note that this test would hang before the fix to pass charset when
     # connecting in services.utils.getconn().
     data = {
         'id': self.addon.guid,
         'reqVersion': '2鎈',
         'appID': amo.FIREFOX.guid,
         'appVersion': '78.0',
     }
     instance = update.Update(data)
     output = instance.get_output()
     update_data = json.loads(output)
     assert update_data
Пример #4
0
 def get(self, data):
     up = update.Update(data)
     up.cursor = connection.cursor()
     return up
Пример #5
0
 def get_update_instance(self, data):
     instance = update.Update(data)
     instance.cursor = connection.cursor()
     return instance