def testGetCurrentBuildStateNoArgs(self):
        """Tests GetCurrentBuildState without arguments."""
        options = cbuildbot_launch.PreParseArguments(
            ['--buildroot', self.root, 'config'])
        state = cbuildbot_launch.GetCurrentBuildState(options, 'master')

        expected_state = build_summary.BuildSummary(
            status=constants.BUILDER_STATUS_INFLIGHT,
            buildroot_layout=2,
            branch='master')
        self.assertEqual(state, expected_state)
    def testGetCurrentBuildStateLayout(self):
        """Test that GetCurrentBuildState uses the current buildroot layout."""
        # Change to a future version.
        self.PatchObject(cbuildbot_launch, 'BUILDROOT_BUILDROOT_LAYOUT', 22)

        options = cbuildbot_launch.PreParseArguments(
            ['--buildroot', self.root, 'config'])
        state = cbuildbot_launch.GetCurrentBuildState(options, 'branchA')

        expected_state = build_summary.BuildSummary(
            status=constants.BUILDER_STATUS_INFLIGHT,
            buildroot_layout=22,
            branch='branchA')
        self.assertEqual(state, expected_state)
    def testGetCurrentBuildStateHasArgs(self):
        """Tests GetCurrentBuildState with arguments."""
        options = cbuildbot_launch.PreParseArguments([
            '--buildroot', self.root, '--buildnumber', '20',
            '--master-build-id', '50', 'config'
        ])
        state = cbuildbot_launch.GetCurrentBuildState(options, 'branchA')

        expected_state = build_summary.BuildSummary(
            build_number=20,
            master_build_id=50,
            status=constants.BUILDER_STATUS_INFLIGHT,
            buildroot_layout=2,
            branch='branchA')
        self.assertEqual(state, expected_state)