def test_attach_to_cert_uuid_hex_string(self): setup_mock_response('AttachToCert') fake_app = app_factory() fake_cert = uuid4() data = _attach_to_cert(fake_app, fake_cert.get_hex()) eq_(data, {'ResultCode': 'Success', 'ErrorMessage': None, 'ErrorID': None}) expected_json = app_data(fake_app) expected_json['CertID'] = unicode(fake_cert) eq_(len(responses.calls), 1) eq_(responses.calls[0].request.url, urljoin(settings.IARC_V2_SERVICE_ENDPOINT, 'AttachToCert')) eq_(json.loads(responses.calls[0].request.body), expected_json)
def test_app_data(self): self.app = app_factory() self.profile = user_factory() self.app.addonuser_set.create(user=self.profile) eq_(app_data(self.app), {'StoreProductID': self.app.guid, 'StoreProductURL': absolutify(self.app.get_url_path()), 'EmailAddress': self.profile.email, 'CompanyName': u'', 'StoreDeveloperID': self.app.pk, 'DeveloperEmail': self.profile.email, 'Publish': True, 'ProductName': unicode(self.app.name)})
def test_app_data_not_public(self): self.app = app_factory() self.profile = user_factory() self.app.addonuser_set.create(user=self.profile) with mock.patch.object(self.app, 'is_public') as is_public_mock: is_public_mock.return_value = False eq_(app_data(self.app), {'StoreProductID': self.app.guid, 'StoreProductURL': absolutify(self.app.get_url_path()), 'EmailAddress': self.profile.email, 'CompanyName': u'', 'StoreDeveloperID': self.app.pk, 'DeveloperEmail': self.profile.email, 'Publish': False, 'ProductName': unicode(self.app.name)})
def test_app_data(self): self.app = app_factory() self.profile = user_factory() self.app.addonuser_set.create(user=self.profile) eq_( app_data(self.app), { 'StoreProductID': self.app.guid, 'StoreProductURL': absolutify(self.app.get_url_path()), 'EmailAddress': self.profile.email, 'CompanyName': u'', 'StoreDeveloperID': self.app.pk, 'DeveloperEmail': self.profile.email, 'Publish': True, 'ProductName': unicode(self.app.name) })
def test_attach_to_cert_uuid_hex_string(self): setup_mock_response('AttachToCert') fake_app = app_factory() fake_cert = uuid4() data = _attach_to_cert(fake_app, fake_cert.get_hex()) eq_(data, { 'ResultCode': 'Success', 'ErrorMessage': None, 'ErrorID': None }) expected_json = app_data(fake_app) expected_json['CertID'] = unicode(fake_cert) eq_(len(responses.calls), 1) eq_(responses.calls[0].request.url, urljoin(settings.IARC_V2_SERVICE_ENDPOINT, 'AttachToCert')) eq_(json.loads(responses.calls[0].request.body), expected_json)
def test_app_data_not_public(self): self.app = app_factory() self.profile = user_factory() self.app.addonuser_set.create(user=self.profile) with mock.patch.object(self.app, 'is_public') as is_public_mock: is_public_mock.return_value = False eq_( app_data(self.app), { 'StoreProductID': self.app.guid, 'StoreProductURL': absolutify(self.app.get_url_path()), 'EmailAddress': self.profile.email, 'CompanyName': u'', 'StoreDeveloperID': self.app.pk, 'DeveloperEmail': self.profile.email, 'Publish': False, 'ProductName': unicode(self.app.name) })