uranusjr commented on a change in pull request #18916:
URL: https://github.com/apache/airflow/pull/18916#discussion_r734206438
##########
File path: tests/cli/commands/test_role_command.py
##########
@@ -81,3 +82,28 @@ def test_cli_list_roles(self):
def test_cli_list_roles_with_args(self):
role_command.roles_list(self.parser.parse_args(['roles', 'list',
'--output', 'yaml']))
+
+ def test_cli_import_roles(self, tmp_path):
+ fn = tmp_path / 'import_roles.json'
+ fn.touch()
+ roles_list = ['FakeTeamA', 'FakeTeamB']
+ with open(fn, 'w') as outfile:
+ json.dump(roles_list, outfile)
+ role_command.roles_import(self.parser.parse_args(['roles', 'import',
fn]))
Review comment:
```suggestion
role_command.roles_import(self.parser.parse_args(['roles', 'import',
str(fn)]))
```
##########
File path: tests/cli/commands/test_role_command.py
##########
@@ -81,3 +82,28 @@ def test_cli_list_roles(self):
def test_cli_list_roles_with_args(self):
role_command.roles_list(self.parser.parse_args(['roles', 'list',
'--output', 'yaml']))
+
+ def test_cli_import_roles(self, tmp_path):
+ fn = tmp_path / 'import_roles.json'
+ fn.touch()
+ roles_list = ['FakeTeamA', 'FakeTeamB']
+ with open(fn, 'w') as outfile:
+ json.dump(roles_list, outfile)
+ role_command.roles_import(self.parser.parse_args(['roles', 'import',
fn]))
+ assert self.appbuilder.sm.find_role('FakeTeamA') is not None
+ assert self.appbuilder.sm.find_role('FakeTeamB') is not None
+
+ def test_cli_export_roles(self, tmp_path):
+ fn = tmp_path / 'export_roles.json'
+ fn.touch()
+ args = self.parser.parse_args(['roles', 'create', 'FakeTeamA',
'FakeTeamB'])
+ role_command.roles_create(args)
+
+ assert self.appbuilder.sm.find_role('FakeTeamA') is not None
+ assert self.appbuilder.sm.find_role('FakeTeamB') is not None
+
+ role_command.roles_export(self.parser.parse_args(['roles', 'export',
fn]))
Review comment:
```suggestion
role_command.roles_export(self.parser.parse_args(['roles', 'export',
str(fn)]))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]