def test_br_select(self): from orm.models import Project, Release, BitbakeVersion, Branch p = Project.objects.create_project("test", Release.objects.get_or_create(name = "HEAD", bitbake_version = BitbakeVersion.objects.get_or_create(name="HEAD", branch=Branch.objects.get_or_create(name="HEAD"))[0])[0]) obr = BuildRequest.objects.create(state = BuildRequest.REQ_QUEUED, project = p) command = Command() br = command._selectBuildRequest() # make sure we select the object we've just built self.assertTrue(obr.id == br.id, "Request is not properly selected") # we have a locked environment self.assertTrue(br.state == BuildRequest.REQ_INPROGRESS, "Request is not updated") # no more selections possible here self.assertRaises(IndexError, command._selectBuildRequest)
def test_br_select(self): from orm.models import Project p, created = Project.objects.get_or_create(pk=1) obr = BuildRequest.objects.create(state=BuildRequest.REQ_QUEUED, project=p) command = Command() br = command._selectBuildRequest() # make sure we select the object we've just built self.assertTrue(obr.id == br.id, "Request is not properly selected") # we have a locked environment self.assertTrue(br.state == BuildRequest.REQ_INPROGRESS, "Request is not updated") # no more selections possible here self.assertRaises(IndexError, command._selectBuildRequest)
def test_bec_select(self): """ Tests that we can find and lock a build environment """ obe = BuildEnvironment.objects.create(lock = BuildEnvironment.LOCK_FREE, betype = BuildEnvironment.TYPE_LOCAL) command = Command() bec = command._selectBuildEnvironment() # make sure we select the object we've just built self.assertTrue(bec.be.id == obe.id, "Environment is not properly selected") # we have a locked environment self.assertTrue(bec.be.lock == BuildEnvironment.LOCK_LOCK, "Environment is not locked") # no more selections possible here self.assertRaises(IndexError, command._selectBuildEnvironment)
def test_bec_select(self): """ Tests that we can find and lock a build environment """ obe = BuildEnvironment.objects.create( lock=BuildEnvironment.LOCK_FREE, betype=BuildEnvironment.TYPE_LOCAL) command = Command() bec = command._selectBuildEnvironment() # make sure we select the object we've just built self.assertTrue(bec.be.id == obe.id, "Environment is not properly selected") # we have a locked environment self.assertTrue(bec.be.lock == BuildEnvironment.LOCK_LOCK, "Environment is not locked") # no more selections possible here self.assertRaises(IndexError, command._selectBuildEnvironment)
def test_br_select(self): from orm.models import Project, Release, BitbakeVersion p = Project.objects.create_project( "test", Release.objects.get_or_create( name="HEAD", bitbake_version=BitbakeVersion.objects.get_or_create( name="HEAD", branch="HEAD")[0])[0]) obr = BuildRequest.objects.create(state=BuildRequest.REQ_QUEUED, project=p) command = Command() br = command._selectBuildRequest() # make sure we select the object we've just built self.assertTrue(obr.id == br.id, "Request is not properly selected") # we have a locked environment self.assertTrue(br.state == BuildRequest.REQ_INPROGRESS, "Request is not updated") # no more selections possible here self.assertRaises(IndexError, command._selectBuildRequest)