def test_slugidjar(self): subject = SlugidJar() self.assertEqual(subject('woot'), subject('woot')) self.assertTrue(type(subject('woot')) is str) other_jar = SlugidJar() self.assertNotEqual(subject('woot'), other_jar('woot'))
def run_task(self, **params): from taskcluster_graph.slugidjar import SlugidJar from taskcluster_graph.from_now import ( json_time_from_now, current_json_time, ) from taskcluster_graph.templates import Templates templates = Templates(ROOT) # Template parameters used when expanding the graph parameters = dict( gaia_info().items() + { 'source': 'http://todo.com/soon', 'project': params['project'], 'comment': params['comment'], 'url': params['url'], 'revision': params['revision'], 'revision_hash': params.get('revision_hash', ''), 'owner': params['owner'], 'as_slugid': SlugidJar(), 'from_now': json_time_from_now, 'now': current_json_time() }.items()) task = templates.load(params['task'], parameters) print(json.dumps(task, indent=4))
def run_task(self, **params): templates = Templates(ROOT) # Template parameters used when expanding the graph parameters = { 'source': 'http://todo.com/soon', 'project': params['project'], 'comment': params['comment'], 'url': params['url'], 'revision': params['revision'], 'owner': params['owner'], 'as_slugid': SlugidJar(), 'from_now': json_time_from_now, 'now': datetime.datetime.now().isoformat() } task = templates.load(params['task'], parameters) print(json.dumps(task, indent=4))