def test_abandon(self, id_generator, args, engine): args.action = "abandon" args.name = id_generator() handle_feature_call(args, engine) engine.assert_has_calls([ mock.call.abandon_feature(name=args.name), ])
def test_list(self, args, engine): args.action = "list" handle_feature_call(args, engine) engine.assert_has_calls([ mock.call.list_features(), ])
def test_work_with_issue_num(self, id_generator, args, engine): args.action = "work" args.issue = True args.identifier = id_generator() handle_feature_call(args, engine) engine.assert_has_calls([mock.call.work_feature(issue=args.identifier)])
def test_publish_failed_hook(self, args, engine): args.action = "publish" with mock.patch('flowhub.core.do_hook') as patch: patch.return_value = False handle_feature_call(args, engine) assert engine.call_count == 0
def test_accepted_no_delete(self, id_generator, args, engine): args.action = "accepted" args.name = id_generator() args.no_delete = True handle_feature_call(args, engine) engine.assert_has_calls([mock.call.accept_feature(name=args.name, delete_feature_branch=False)])
def test_work(self, id_generator, args, engine): args.action = "work" args.issue = None args.identifier = id_generator() handle_feature_call(args, engine) engine.assert_has_calls([ mock.call.work_feature(name=args.identifier), ])
def test_start_with_issue_number(self, id_generator, args, engine): args.action = "start" args.name = id_generator(chars=string.ascii_letters) args.issue_num = id_generator(chars=string.digits) expected_name = "{}-{}".format(args.issue_number, args.name) args.track = False handle_feature_call(args, engine) engine.assert_has_calls([mock.call.create_feature(name=expected_name, with_tracking=args.track)])
def test_publish(self, id_generator, args, engine): args.action = "publish" args.name = id_generator() with mock.patch("flowhub.core.do_hook") as patch: patch.return_value = True handle_feature_call(args, engine) patch.assert_has_calls([mock.call(args, engine, "pre-feature-publish")]) engine.assert_has_calls([mock.call.publish_feature(name=args.name)])
def test_start(self, id_generator, args, engine): args.action = "start" args.issue_num = None args.name = id_generator(chars=string.ascii_letters) args.track = False with mock.patch("flowhub.core.do_hook") as patch: patch.return_value = True handle_feature_call(args, engine) patch.assert_has_calls([mock.call(args, engine, "post-feature-start")]) engine.assert_has_calls([mock.call.create_feature(name=args.name, with_tracking=args.track)])
def test_undefined_action(self, id_generator, args, engine): args.action = id_generator() with pytest.raises(RuntimeError): handle_feature_call(args, engine)