diff --git a/smart_tests/commands/record/session.py b/smart_tests/commands/record/session.py index c9f315a8f..d77007367 100644 --- a/smart_tests/commands/record/session.py +++ b/smart_tests/commands/record/session.py @@ -24,19 +24,18 @@ @args4p.command(help="Record session information") def session( app: Application, - build_name: Annotated[str, typer.Option( + build_name: Annotated[str | None, typer.Option( "--build", help="Build name", metavar="NAME", - required=True - )], + )] = None, test_suite: Annotated[str, typer.Option( "--test-suite", help="Set test suite name. A test suite is a collection of test sessions. Setting a test suite allows you to " "manage data over test sessions and lineages.", metavar="NAME", required=True - )], + )] = "", flavors: Annotated[List[KeyValue], typer.Option( "--flavor", help="Flavors", diff --git a/tests/commands/record/test_session.py b/tests/commands/record/test_session.py index 73d4e471a..3d8718d72 100644 --- a/tests/commands/record/test_session.py +++ b/tests/commands/record/test_session.py @@ -206,3 +206,24 @@ def invoke(*args): # Invalid URL result = invoke("--link", "GITHUB_PULL_REQUEST|PR=https://github.com/launchableinc/cli/pull/2/files") self.assertIn("Invalid url 'https://github.com/launchableinc/cli/pull/2/files' passed to --link option", result.output) + + @responses.activate + @mock.patch.dict(os.environ, { + "SMART_TESTS_TOKEN": CliTestCase.smart_tests_token, + 'LANG': 'C.UTF-8', + }, clear=True) + def test_run_session_with_no_build(self): + result = self.cli( + "record", "session", "--no-build", + "--test-suite", "test-suite") + self.assert_success(result) + + payload = json.loads(responses.calls[1].request.body.decode()) + self.assert_json_orderless_equal({ + "flavors": {}, + "isObservation": False, + "links": [], + "noBuild": True, + "testSuite": "test-suite", + "timestamp": None, + }, payload)