def test_try_negative(self, MockPullReqState): state = MockPullReqState() action._try(state, 'try-', False, {}) self.assertFalse(state.try_) state.init_build_res.assert_called_once_with([]) state.save.assert_called_once_with() assert not state.change_labels.called, 'change_labels was called and should never be.'
def test_try_positive(self, MockPullReqState): state = MockPullReqState() action._try(state, 'try', False, {}) self.assertTrue(state.try_) state.init_build_res.assert_called_once_with([]) state.save.assert_called_once_with() state.change_labels.assert_called_once_with(LabelEvent.TRY)
def test_try_chooser_found(self, MockPullReqState): state = MockPullReqState() action._try(state, 'try', True, TRY_CHOOSER_CONFIG, choose="mac") self.assertTrue(state.try_) self.assertEqual(state.try_choose, "mac") state.init_build_res.assert_called_once_with([]) state.save.assert_called_once_with() state.change_labels.assert_called_once_with(LabelEvent.TRY)
def test_try_chooser_no_setup(self, MockPullReqState): state = MockPullReqState() action._try(state, 'try', True, {}, choose="foo") self.assertTrue(state.try_) state.init_build_res.assert_called_once_with([]) state.save.assert_called_once_with() state.change_labels.assert_called_once_with(LabelEvent.TRY) state.add_comment.assert_called_once_with( ":slightly_frowning_face: This repo does not have try choosers set up" )
def test_try_chooser_not_found(self, MockPullReqState): state = MockPullReqState() action._try(state, 'try', True, TRY_CHOOSER_CONFIG, choose="foo") self.assertEqual(state.try_choose, None) state.init_build_res.assert_not_called() state.save.assert_not_called() state.change_labels.assert_not_called() state.add_comment.assert_called_once_with( ":slightly_frowning_face: There is no try chooser foo for this repo, try one of: taskcluster, mac, wpt" )
def test_try_chooser_without_buildbot_found(self, MockPullReqState): state = MockPullReqState() action._try(state, 'try', True, TRY_CHOOSER_WITHOUT_BUILDBOT_CONFIG, choose="taskcluster") self.assertTrue(state.try_) self.assertEqual(state.try_choose, "taskcluster") state.init_build_res.assert_called_once_with([]) state.save.assert_called_once_with() state.change_labels.assert_called_once_with(LabelEvent.TRY)