diff --git a/static/js/app.js b/static/js/app.js index a0c4fb3fd..17894fcd3 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1,5 +1,5 @@ var TEAM_PATTERN = '^[a-zA-Z][a-zA-Z0-9]+$'; -var ROBOT_PATTERN = '^[a-zA-Z][a-zA-Z0-9]{3,29}$'; +var ROBOT_PATTERN = '^[a-zA-Z][a-zA-Z0-9_]{3,29}$'; var USER_PATTERN = '^[a-z0-9_]{4,30}$'; // Define the pages module. diff --git a/test/test_api_usage.py b/test/test_api_usage.py index 7d6d07046..c39ac4fec 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -2512,6 +2512,26 @@ class TestOrgRobots(ApiTestCase): return [r['name'] for r in self.getJsonResponse(OrgRobotList, params=dict(orgname=ORGANIZATION))['robots']] + def test_create_robot_with_underscores(self): + self.login(ADMIN_ACCESS_USER) + + # Create the robot. + self.putJsonResponse(OrgRobot, + params=dict(orgname=ORGANIZATION, robot_shortname='mr_bender'), + expected_code=201) + + # Add the robot to a team. + membername = ORGANIZATION + '+mr_bender' + self.putJsonResponse(TeamMember, + params=dict(orgname=ORGANIZATION, teamname='readers', + membername=membername)) + + # Retrieve the robot's details. + self.getJsonResponse(OrgRobot, + params=dict(orgname=ORGANIZATION, robot_shortname='mr_bender'), + expected_code=200) + + def test_delete_robot_after_use(self): self.login(ADMIN_ACCESS_USER)