def test_create_pipeline(self): projecta = self.create_project() projectb = self.create_project(name=u"ProjectB") repository = PipelineRepository() created_pipeline = repository.create(name=u"Test Pipeline", pipeline_definition="ProjectA > ProjectB") pipeline = repository.get(created_pipeline.id) self.assertEqual(pipeline.name, u"Test Pipeline") self.assertEqual(len(pipeline.items), 2) self.assertNotEqual(pipeline.items[0].project, None) self.assertNotEqual(pipeline.items[1].project, None) self.assertEqual(pipeline.items[0].project.id, projecta.id) self.assertEqual(pipeline.items[1].project.id, projectb.id) self.assertEqual(str(pipeline), "ProjectA > ProjectB")
def test_update_pipeline(self): projecta = self.create_project(name="A") projectb = self.create_project(name=u"B") projectc = self.create_project(name=u"C") repository = PipelineRepository() created_pipeline = repository.create(name=u"Test Pipeline", pipeline_definition="A > B") repository.update(created_pipeline.id, name=u"Updated Pipeline", pipeline_definition="B > A > C") pipeline = repository.get(created_pipeline.id) self.assertEqual(pipeline.name, u"Updated Pipeline") self.assertEqual(len(pipeline.items), 3) self.assertNotEqual(pipeline.items[0].project, None) self.assertNotEqual(pipeline.items[1].project, None) self.assertNotEqual(pipeline.items[2].project, None) self.assertEqual(pipeline.items[0].project.id, projectb.id) self.assertEqual(pipeline.items[1].project.id, projecta.id) self.assertEqual(pipeline.items[2].project.id, projectc.id) self.assertEqual(str(pipeline), "B > A > C")