def test_license_not_set(self): sender = smarty.RequestsSender() sender = smarty.LicenseSender([], sender) request = smarty.Request() request.url_prefix = "http://localhost" sender.send(request) self.assertEqual(0, len(request.parameters))
def test_license_set(self): sender = smarty.RequestsSender() licenses = ['one', 'two', 'three'] sender = smarty.LicenseSender(licenses, sender) request = smarty.Request() request.url_prefix = "http://localhost" sender.send(request) self.assertEqual('one,two,three', request.parameters['license'])
def build_sender(self): if self.http_sender is not None: return self.http_sender sender = smarty.RequestsSender(self.max_timeout, self.proxy) sender.debug = self.debug sender = smarty.StatusCodeSender(sender) if self.header is not None: sender = smarty.CustomHeaderSender(self.header, sender) if self.signer is not None: sender = smarty.SigningSender(self.signer, sender) if self.max_retries > 0: sender = smarty.RetrySender(self.max_retries, sender) sender = smarty.URLPrefixSender(self.url_prefix, sender) sender = smarty.LicenseSender(self.licenses, sender) return sender