本文整理汇总了Python中jira.JIRA.search_users方法的典型用法代码示例。如果您正苦于以下问题:Python JIRA.search_users方法的具体用法?Python JIRA.search_users怎么用?Python JIRA.search_users使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jira.JIRA
的用法示例。
在下文中一共展示了JIRA.search_users方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestUsers
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import search_users [as 别名]
class TestUsers(unittest.TestCase):
def setUp(self):
self.jira = JIRA(options=dict(server=TEST_URL, verify=False), basic_auth=(TEST_USERNAME, TEST_PASSWORD))
self.purge_test_users()
def tearDown(self):
self.purge_test_users()
def get_user(self, username):
users = [_ for _ in self.jira.search_users(user=username) if _.name == username]
return users[0] if len(users) == 1 else None
def purge_test_users(self):
users = [_ for _ in self.jira.search_users(user='test-') if _.name.startswith('test-')]
for _ in users:
_.delete()
def test_create_user(self):
self.assertIsNone(self.get_user('test-1'))
result = CliRunner().invoke(topcli, ['user', 'create', 'test-1', 'test-1' + '@gmail.com'])
self.assertEqual(result.exit_code, 0)
self.assertIsNotNone(self.get_user('test-1'))
def test_delete_user(self):
result = CliRunner().invoke(topcli, ['user', 'create', 'test-1', 'test-1' + '@gmail.com'])
self.assertEqual(result.exit_code, 0)
self.assertIsNotNone(self.get_user('test-1'))
result = CliRunner().invoke(topcli, ['user', 'delete', 'test-1'])
self.assertEqual(result.exit_code, 0)
self.assertIsNone(self.get_user('test-1'))
def test_update_user(self):
result = CliRunner().invoke(topcli, ['user', 'create', 'test-1', '[email protected]'])
before = self.get_user('test-1')
self.assertEqual(before.emailAddress, '[email protected]')
result = CliRunner().invoke(topcli, ['user', 'update', 'test-1', '-e', '[email protected]'])
self.assertEqual(result.exit_code, 0)
after = self.get_user('test-1')
self.assertEqual(after.emailAddress, '[email protected]')
def test_search_user(self):
result = CliRunner().invoke(topcli, ['user', 'create', 'test-1', 'test-1' + '@gmail.com'])
result = CliRunner().invoke(topcli, ['user', 'search'])
self.assertEqual(result.exit_code, 0)
before = len(result.output.strip().split('\n'))
self.assertGreater(before, 1)
result = CliRunner().invoke(topcli, ['user', 'search', '-f', 'test-1'])
self.assertEqual(result.exit_code, 0)
after = len(result.output.strip().split('\n'))
self.assertEqual(after, 1)