Example #1
0
    def test_pingback(self):
        urllib2.urlopen = Mock(return_value=open(
            os.path.join(settings.ROOT, 'apps/xpi/tests/sample_addons/',
                         '%s.xpi' % self.sample_addons[0])))
        rebuild_from_location(os.path.join(self.xpi_file_prefix,
                                           '%s.xpi' % self.sample_addons[0]),
                              self.sdk_source_dir,
                              self.hashtag,
                              pingback='test_pingback',
                              options='--strip-xpi')

        desired_response = {
            'msg':
            'Exporting extension to sample_add-on.xpi.',
            'secret':
            settings.AMO_SECRET_KEY,
            'location':
            '%s%s' % (settings.SITE_URL,
                      reverse('jp_download_xpi',
                              args=[self.hashtag, self.sample_addons[0]])),
            'post':
            None,
            'id':
            'jid0-S9EIBmWttfoZn92i5toIRoKXb1Y',
            'result':
            'success'
        }
        params = urlparse.parse_qs(urllib2.urlopen.call_args[1]['data'])
        eq_(desired_response['secret'], params['secret'][0])
        eq_(desired_response['location'], params['location'][0])
        eq_(desired_response['result'], params['result'][0])
Example #2
0
    def test_pingback(self):
        urllib2.urlopen = Mock(return_value=open(os.path.join(
                settings.ROOT, 'apps/xpi/tests/sample_addons/',
                '%s.xpi' % self.sample_addons[0])))
        rebuild_from_location(
                os.path.join(
                    self.xpi_file_prefix, '%s.xpi' % self.sample_addons[0]),
                self.sdk_source_dir, self.hashtag,
                pingback='test_pingback',
                options='--strip-xpi')

        desired_response = {
                'msg': 'Exporting extension to sample_add-on.xpi.',
                'secret': settings.AMO_SECRET_KEY,
                'location': '%s%s' % (settings.SITE_URL,
                    reverse('jp_download_xpi', args=[
                        self.hashtag, self.sample_addons[0]])),
                'post': None,
                'id': 'jid0-S9EIBmWttfoZn92i5toIRoKXb1Y',
                'result': 'success'}
        params = urlparse.parse_qs(urllib2.urlopen.call_args[1]['data'])
        eq_(desired_response['secret'], params['secret'][0])
        eq_(desired_response['location'], params['location'][0])
        eq_(desired_response['result'], params['result'][0])
Example #3
0
 def test_download_and_rebuild(self):
     test_file = os.path.join(self.xpi_file_prefix,
                              '%s.xpi' % self.sample_addons[0])
     rep_response = rebuild_from_location(test_file, self.sdk_source_dir,
                                          self.hashtag)
     assert not rep_response[1]
Example #4
0
 def test_download_and_rebuild(self):
     test_file = os.path.join(
                 self.xpi_file_prefix, '%s.xpi' % self.sample_addons[0])
     rep_response = rebuild_from_location(test_file, self.sdk_source_dir,
         self.hashtag)
     assert not rep_response[1]