def get_caption(job_id, caption_options, caption_format, username, password, api_securekey, api_token, server_url, verbose_mode): print "Getting caption..." __set_verbose(verbose_mode) actions = __initialize_actions(server_url) token = __get_token(actions, username, password, api_securekey, api_token) # Parse options caption_opts = CaptionOptions() caption_opts.populate_from_list(caption_options) caption = actions.get_caption(token, job_id, caption_format, caption_opts) print caption
def test_options_populate_from_list(self): options = CaptionOptions() options.populate_from_list(['build_url=true', 'dfxp_header=header']) # Can only assert length because Dict produces different order each time self.assertEqual(len('build_url=true&dfxp_header=header'), len(options.to_query()))