def test_status(self): from pybacklogpy.Licence import Licence l = Licence() if response_to_json(l.get_licence())['licenceTypeId'] == 11: self.skipTest(reason='無料版ライセンスだとカスタム状態の設定ができない') response_add_status = self.status.add_status( project_id_or_key=self.project_key, name='保留', color='#ea2c00', ) self.assertTrue(response_add_status.ok, msg='状態の追加に失敗') status_id = response_to_json(response_add_status)['id'] response_update_status = self.status.update_status( project_id_or_key=self.project_key, status_id=status_id, name='明日やる', color='#868cb7', ) self.assertTrue(response_update_status.ok, msg='状態の更新に失敗') response_update_order = self.status.update_order_of_status( project_id_or_key=self.project_key, status_id=[1, 2, status_id, 3, 4], ) self.assertTrue(response_update_order.ok, msg='状態の順序の更新に失敗') response_delete_status = self.status.delete_status( project_id_or_key=self.project_key, status_id=status_id, substitute_status_id=1, ) self.assertTrue(response_delete_status.ok, msg='状態の削除に失敗')
def test_edit_version(self): version_num_before_add = len( response_to_json( self.version.get_version_milestone_list( project_id_or_key=self.project_key, ))) response_post = self.version.add_version_milestone( project_id_or_key=self.project_key, name=basic_version_data['name'], description=basic_version_data['description'], start_date=basic_version_data['start_date'], release_due_date=basic_version_data['release_due_date']) self.assertTrue(response_post, msg='バージョンの追加に失敗') response_post_dict = response_to_json(response_post) self.assertIsInstance(response_post_dict, dict, msg='バージョン追加のレスポンスが辞書でない') version_id = response_post_dict['id'] version_num_after_add = len( response_to_json( self.version.get_version_milestone_list( project_id_or_key=self.project_key, ))) self.assertEqual(version_num_before_add + 1, version_num_after_add, msg='バージョンを追加したにもかかわらず数が増えていない') response_patch = self.version.update_version_milestone( version_id=version_id, project_id_or_key=self.project_key, name=updated_version_data['name'], description=updated_version_data['description'], archived=updated_version_data['archived'], start_date=updated_version_data['start_date'], release_due_date=updated_version_data['release_due_date']) self.assertTrue(response_patch.ok, msg='バージョンの更新に失敗') response_patch_dict = response_to_json(response_patch) self.assertIsInstance(response_patch_dict, dict, msg='バージョン更新のレスポンスが辞書でない') response_delete = self.version.delete_version( project_id_or_key=self.project_key, version_id=version_id, ) self.assertTrue(response_delete.ok, msg='バージョンの削除に失敗') version_num_after_delete = len( response_to_json( self.version.get_version_milestone_list( project_id_or_key=self.project_key, ))) self.assertEqual(version_num_after_add - 1, version_num_after_delete, msg='バージョンを削除したにもかかわらず数が減っていない')
def test_get_custom_field(self): from pybacklogpy.Licence import Licence l = Licence() if response_to_json(l.get_licence())['licenceTypeId'] == 11: self.skipTest(reason='無料版ライセンスだとカスタム属性の設定ができない') response = self.custom_field.get_custom_field_list( project_id_or_key=self.project_key ) self.assertTrue(response.ok, msg='カスタム属性一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='カスタム属性一覧の取得に失敗')
def test_add_wiki_page(self): wiki_page_count_before = response_to_json( self.wiki.count_wiki_page(self.project_key))['count'] response_post = self.wiki.add_wiki_page( project_id=self.project_id, name=basic_wiki_data['name'], content=basic_wiki_data['content'], mail_notify=basic_wiki_data['mail_notify']) self.assertTrue(response_post.ok, msg='Wikiページの追加リクエストに失敗') wiki_page_count_after = response_to_json( self.wiki.count_wiki_page(self.project_key))['count'] self.assertEqual(wiki_page_count_before + 1, wiki_page_count_after, '追加したにもかかわらずWikiページ数が増えていない')
def test_issue_type(self): response_issue_list = self.issue_type.get_issue_type_list( project_id_or_key=self.project_key) self.assertTrue(response_issue_list.ok, msg='種別一覧の取得に失敗') issue_type_list = response_to_json(response_issue_list) self.assertIsInstance(issue_type_list, list, msg='課題追加のレスポンスがリストでない') issue_type_num_before_add = len(issue_type_list) response_delete = self.issue_type.delete_issue_type( project_id_or_key=self.project_key, issue_id=issue_type_list[3]['id'], substitute_issue_type_id=issue_type_list[0]['id']) self.assertTrue(response_delete.ok, msg='種別の削除に失敗') response_issue_list_2 = self.issue_type.get_issue_type_list( project_id_or_key=self.project_key) issue_type_list_2 = response_to_json(response_issue_list_2) issue_type_num_after_delete = len(issue_type_list_2) self.assertEqual(issue_type_num_before_add - 1, issue_type_num_after_delete, '種別を削除したにもかかわらず課題数が減っていない') response_post = self.issue_type.add_issue_type( project_id_or_key=self.project_key, name='TEST', color='#e30000', ) self.assertTrue(response_post.ok, msg='種別の種類追加に失敗') response_post_dict = response_to_json(response_post) self.assertIsInstance(response_post_dict, dict, msg='種別追加のレスポンスが辞書でない') issue_id = response_post_dict['id'] response_issue_list_3 = self.issue_type.get_issue_type_list( project_id_or_key=self.project_key) issue_type_list_3 = response_to_json(response_issue_list_3) issue_type_num_after_add = len(issue_type_list_3) self.assertEqual(issue_type_num_after_delete + 1, issue_type_num_after_add, '種別を追加したにもかかわらず数が増えていない') response_patch = self.issue_type.update_issue_type( project_id_or_key=self.project_key, issue_id=issue_id, name='その他', color='#2779ca', ) self.assertTrue(response_patch.ok, msg='課題情報の更新に失敗') response_patch_dict = response_to_json(response_patch) self.assertIsInstance(response_patch_dict, dict, msg='種別更新のレスポンスが辞書でない')
def test_get_user_list(self): user = User() response = user.get_user_list() self.assertTrue(response.ok, msg='ユーザー一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='ユーザー一覧の取得に失敗') self.assertNotEqual(response_list, [], msg='ユーザー一覧の取得に失敗')
def test_get_user_recent_updates(self): user_id = self.myself_user_id with self.assertRaises(ValueError, msg='ユーザーの最近の活動取得時、取得上限のルールのバリデーションに失敗'): self.user.get_user_recent_updates( user_id=user_id, count=0, ) with self.assertRaises(ValueError, msg='ユーザーの最近の活動取得時、取得上限のルールのバリデーションに失敗'): self.user.get_user_recent_updates( user_id=user_id, order='abc', ) with self.assertRaises(ValueError, msg='ユーザーの最近の活動取得時、activity_type_idのバリデーションに失敗'): self.user.get_user_recent_updates( user_id=user_id, activity_type_id=[0], ) with self.assertRaises(ValueError, msg='ユーザーの最近の活動取得時、activity_type_idのバリデーションに失敗'): self.user.get_user_recent_updates( user_id=user_id, activity_type_id=[1, 2, 3, 18], ) response = self.user.get_user_recent_updates( user_id=user_id, activity_type_id=[ACTIVITY_TYPE['課題の追加']], min_id=1, count=10, order='asc', ) self.assertTrue(response.ok, msg='ユーザーの最近の活動取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='ユーザーの最近の活動取得のレスポンスがリストでない')
def test_get_license(self): licence = Licence() response = licence.get_licence() self.assertTrue(response.ok, msg='ライセンス情報の取得に失敗') response_dict = response_to_json(response) self.assertIsInstance(response_dict, dict, msg='ライセンス情報の取得に失敗') self.assertNotEqual(response_dict, [], msg='ライセンス情報の取得に失敗')
def test_get_list_of_webhook(self): # Key response = self.webhook.get_list_of_webhooks( project_id_or_key=self.project_key ) self.assertTrue(response.ok, msg='Webhook一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='Webhook一覧の取得に失敗') # ID response = self.webhook.get_list_of_webhooks( project_id_or_key=str(self.project_id) ) self.assertTrue(response.ok, msg='Webhook一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='Webhook一覧の取得に失敗')
def test_get_watching_list(self): with self.assertRaises(ValueError, msg='ウォッチ一覧の取得時、orderのバリデーションに失敗'): self.watch.get_watching_list( user_id=self.user_id, order='abc', ) with self.assertRaises(ValueError, msg='ウォッチ一覧の取得時、countのバリデーションに失敗'): self.watch.get_watching_list( user_id=self.user_id, count=0, ) with self.assertRaises(ValueError, msg='ウォッチ一覧の取得時、countのバリデーションに失敗'): self.watch.get_watching_list( user_id=self.user_id, count=101, ) response_get = self.watch.get_watching_list( user_id=self.user_id, order='asc', count=2, offset=0, resource_already_read=False, issue_id=[self.issue_id]) self.assertTrue(response_get.ok, msg='ウォッチ一覧の取得に失敗') response_list = response_to_json(response_get) self.assertIsInstance(response_list, list, msg='ウォッチ一覧取得のレスポンスがリストでない')
def test_get_list_of_git_repositories(self): response = self.git_repository.get_list_of_git_repositories( project_id_or_key=self.project_key ) self.assertTrue(response.ok, msg='Gitリポジトリ一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='Gitリポジトリ一覧の取得に失敗')
def test_wiki_page_history(self): wiki_id = get_wiki_id() with self.assertRaises(ValueError, msg='Wikiページ更新履歴一覧の取得時、orderのバリデーションに失敗'): self.wiki.get_wiki_page_history( wiki_id=wiki_id, order='abc', ) with self.assertRaises(ValueError, msg='Wikiページ更新履歴一覧の取得時、countのバリデーションに失敗'): self.wiki.get_wiki_page_history( wiki_id=wiki_id, count=0, ) with self.assertRaises(ValueError, msg='Wikiページ更新履歴一覧の取得時、countのバリデーションに失敗'): self.wiki.get_wiki_page_history( wiki_id=wiki_id, count=101, ) response_get = self.wiki.get_wiki_page_history( wiki_id=wiki_id, count=1, order='asc', ) self.assertTrue(response_get.ok, msg='Wikiページ更新履歴一覧の取得に失敗') response_list = response_to_json(response_get) self.assertIsInstance(response_list, list, msg='Wikiページ更新履歴一覧がリストオブジェクトではない')
def test_delete_wiki_page(self): now = datetime.now() r = self.wiki.add_wiki_page(project_id=self.project_id, name=get_YYYYMMDDHHMMSS_name( 'wiki_to_delete', now), content=basic_wiki_data['content'], mail_notify=basic_wiki_data['mail_notify']) delete_wiki_id = response_to_json(r)['id'] wiki_page_count_before = response_to_json( self.wiki.count_wiki_page(self.project_key))['count'] response_delete = self.wiki.delete_wiki_page(wiki_id=delete_wiki_id) self.assertTrue(response_delete.ok, msg='Wikiの削除に失敗') wiki_page_count_after = response_to_json( self.wiki.count_wiki_page(self.project_key))['count'] self.assertEqual(wiki_page_count_before - 1, wiki_page_count_after, '削除したにもかかわらずWikiページ数が減っていない')
def test_get_version_milestone_list(self): response = self.version.get_version_milestone_list( project_id_or_key=self.project_key) self.assertTrue(response.ok, msg='バージョン(マイルストーン)一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='バージョン(マイルストーン)一覧の取得に失敗')
def test_get_wiki_page_tag_list(self): response_get = self.wiki.get_wiki_page_tag_list( project_id_or_key=self.project_id, ) self.assertTrue(response_get.ok, msg='Wikiページタグ一覧の取得に失敗') response_list = response_to_json(response_get) self.assertIsInstance(response_list, list, msg='Wikiページタグ一覧がリストオブジェクトではない')
def test_get_wiki_page_star(self): wiki_id = get_wiki_id() response_get = self.wiki.get_wiki_page_star(wiki_id=wiki_id, ) self.assertTrue(response_get.ok, msg='Wikiページのスター一覧の取得に失敗') response_list = response_to_json(response_get) self.assertIsInstance(response_list, list, msg='Wikiページのスター一覧がリストオブジェクトではない')
def test_edit_webhook(self): webhook_num_before_add = len(response_to_json( self.webhook.get_list_of_webhooks(project_id_or_key=self.project_key), )) response_post = self.webhook.add_webhook( project_id_or_key=self.project_key, name=basic_webhook_data['name'], description=basic_webhook_data['description'], hook_url=basic_webhook_data['hook_url'], all_event=basic_webhook_data['all_event'], activity_type_ids=basic_webhook_data['activity_type_ids'], ) self.assertTrue(response_post.ok, msg='Webhookの追加に失敗') response_post_dict = response_to_json(response_post) self.assertIsInstance(response_post_dict, dict, msg='Webhook追加のレスポンスが辞書でない') webhook_id = response_post_dict['id'] webhook_num_after_add = len(response_to_json( self.webhook.get_list_of_webhooks(project_id_or_key=self.project_key), )) self.assertEqual(webhook_num_before_add + 1, webhook_num_after_add, msg='Webhookを追加したにもかかわらず数が増えていない') response_patch = self.webhook.update_webhook( project_id_or_key=self.project_key, webhook_id=webhook_id, name=updated_webhook_data['name'], description=updated_webhook_data['description'], hook_url=updated_webhook_data['hook_url'], all_event=updated_webhook_data['all_event'], activity_type_ids=updated_webhook_data['activity_type_ids'], ) self.assertTrue(response_patch.ok, msg='Webhookの更新に失敗') response_patch_dict = response_to_json(response_patch) self.assertIsInstance(response_patch_dict, dict, msg='Webhook更新のレスポンスが辞書でない') response_get = self.webhook.get_webhook( project_id_or_key=self.project_key, webhook_id=webhook_id, ) self.assertTrue(response_get.ok, msg='Webhookの取得に失敗') response_get_dict = response_to_json(response_get) self.assertIsInstance(response_get_dict, dict, msg='Webhook取得のレスポンスが辞書でない') self.assertEqual(response_get_dict['name'], updated_webhook_data['name'], msg='Webhook の名前が正しく更新されていない') self.assertEqual(response_get_dict['description'], updated_webhook_data['description'], msg='Webhook の詳細が正しく更新されていない') self.assertEqual(response_get_dict['activityTypeIds'], updated_webhook_data['activity_type_ids'], msg='Webhook の通知するイベントIDが正しく更新されていない') response_delete = self.webhook.delete_webhook( project_id_or_key=self.project_key, webhook_id=webhook_id, ) self.assertTrue(response_delete.ok, msg='Webhookの削除に失敗') webhook_num_after_delete = len(response_to_json( self.webhook.get_list_of_webhooks(project_id_or_key=self.project_key), )) self.assertEqual(webhook_num_after_add - 1, webhook_num_after_delete, msg='Webhookを削除したにもかかわらず数が減っていない')
def test_get_list_of_teams(self): with self.assertRaises(ValueError, msg='チーム一覧取得時、orderのバリデーションに失敗'): self.team.get_list_of_teams( order='aaa', ) with self.assertRaises(ValueError, msg='チーム一覧取得時、countのバリデーションに失敗'): self.team.get_list_of_teams( count=10000, ) response = self.team.get_list_of_teams( order='asc', count=1, ) self.assertTrue(response.ok, msg='チーム一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='チーム一覧の取得に失敗')
def test_get_list_of_recently_viewed_wikis(self): with self.assertRaises(ValueError, msg='自分が最近見たWiki一覧の取得時、取得上限のルールのバリデーションに失敗'): self.user.get_list_of_recently_viewed_wikis( count=0, ) with self.assertRaises(ValueError, msg='自分が最近見たWiki一覧の取得時、取得順序のルールのバリデーションに失敗'): self.user.get_list_of_recently_viewed_wikis( order='abc', ) response = self.user.get_list_of_recently_viewed_wikis( count=2, offset=0, order='asc', ) self.assertTrue(response.ok, msg='自分が最近見たWiki一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, (list, dict), msg='自分が最近見たWiki一覧の取得のレスポンス形式が不正')
def test_get_notification(self): with self.assertRaises(ValueError, msg='お知らせ一覧の取得時、取得上限のルールのバリデーションに失敗'): self.notification.get_notification( count=0, order='asc', ) with self.assertRaises(ValueError, msg='お知らせ一覧の取得時、取得上限のルールのバリデーションに失敗'): self.notification.get_notification( count=10, order='abc', ) response = self.notification.get_notification( count=10, order='asc', ) self.assertTrue(response.ok, msg='お知らせ一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, (list, dict), msg='お知らせ一覧の取得に失敗')
def test_edit_issue(self): response_issue_list = self.issue_type.get_issue_type_list( project_id_or_key=self.project_key) issue_type_list = response_to_json(response_issue_list) issue_num_before_add = response_to_json( self.issue.count_issue(project_id=[self.project_id], ))['count'] response_post = self.issue.add_issue( project_id=self.project_id, summary=basic_issue_data['summary'], issue_type_id=issue_type_list[0]['id'], priority_id=basic_issue_data['priority_id'], description=basic_issue_data['description'], start_date=basic_issue_data['start_date'], due_date=basic_issue_data['due_date'], ) self.assertTrue(response_post.ok, msg='課題の追加に失敗') response_post_dict = response_to_json(response_post) self.assertIsInstance(response_post_dict, dict, msg='課題追加のレスポンスが辞書でない') issue_key = response_post_dict['issueKey'] issue_num_after_add = response_to_json( self.issue.count_issue(project_id=[self.project_id], ))['count'] self.assertEqual(issue_num_before_add + 1, issue_num_after_add, msg='課題を追加したにも関わらず課題数が増えていない') response_patch = self.issue.update_issue( issue_id_or_key=str(issue_key), summary=updated_issue_data['summary'], issue_type_id=issue_type_list[1]['id'], priority_id=updated_issue_data['priority_id'], description=updated_issue_data['description'], start_date=updated_issue_data['start_date'], due_date=updated_issue_data['due_date'], ) self.assertTrue(response_patch.ok, msg='課題の更新に失敗') response_patch_dict = response_to_json(response_patch) self.assertIsInstance(response_patch_dict, dict, msg='課題追加のレスポンスが辞書でない') response_delete = self.issue.delete_issue(issue_id_or_key=issue_key, ) self.assertTrue(response_delete.ok, msg='課題の削除に失敗') issue_num_after_delete = response_to_json( self.issue.count_issue(project_id=[self.project_id], ))['count'] self.assertEqual(issue_num_after_add - 1, issue_num_after_delete, msg='課題を削除したにも関わらず課題数が減っていない')
def test_count_user_received_stars(self): user_id = self.myself_user_id with self.assertRaises(ValueError, msg='ユーザーが受け取ったスター数の取得のsinceのバリデーションに失敗'): self.user.count_user_received_stars( user_id=user_id, since='2019-1-1' ) with self.assertRaises(ValueError, msg='ユーザーが受け取ったスター数の取得のuntilのバリデーションに失敗'): self.user.count_user_received_stars( user_id=user_id, until='2019/01/01' ) response = self.user.count_user_received_stars( user_id=user_id, since='2000-01-01', until='2099-12-31' ) self.assertTrue(response.ok, msg='ユーザーの受け取ったスターの数の取得に失敗') response_dict = response_to_json(response) self.assertIsInstance(response_dict, dict, msg='ユーザーの受け取ったスターの数のレスポンスが辞書でない')
def test_get_received_star_list(self): user_id = self.myself_user_id with self.assertRaises(ValueError, msg='ユーザーの受け取ったスター一覧の取得時、取得上限のルールのバリデーションに失敗'): self.user.get_received_star_list( user_id=user_id, count=0, ) with self.assertRaises(ValueError, msg='ユーザーの受け取ったスター一覧の取得時、取得順序のルールのバリデーションに失敗'): self.user.get_received_star_list( user_id=user_id, order='abc', ) response = self.user.get_received_star_list( user_id=user_id, min_id=1, count=2, order='asc', ) self.assertTrue(response.ok, msg='ユーザーの受け取ったスター一覧の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, (list, dict), msg='ユーザーの受け取ったスター一覧の取得のレスポンスが不正')
def test_get_recent_updates(self): with self.assertRaises(ValueError, msg='最近の更新の取得時、orderのバリデーションに失敗'): self.space.get_recent_updates( order='abc', ) with self.assertRaises(ValueError, msg='最近の更新の取得時、countのバリデーションに失敗'): self.space.get_recent_updates( count=0, ) with self.assertRaises(ValueError, msg='最近の更新の取得時、countのバリデーションに失敗'): self.space.get_recent_updates( count=101, ) response = self.space.get_recent_updates( activity_type_id=[i for i in range(1, 27)], min_id=1, count=2, order='asc', ) self.assertTrue(response.ok, msg='最近の更新の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, list, msg='最近の更新のレスポンスがリストでない')
def test_update_wiki_page(self): now = datetime.now() wiki_id = get_wiki_id() response = self.wiki.update_wiki_page( wiki_id=wiki_id, name=updated_wiki_data['name'], content=updated_wiki_data['content'], mail_notify=updated_wiki_data['mail_notify'], ) self.assertTrue(response.ok, msg='Wikiの更新に失敗') response_dict = response_to_json(response) self.assertEqual(response_dict['name'], updated_wiki_data['name'], msg='更新後のWikiタイトルが不正') self.assertEqual(response_dict['content'], updated_wiki_data['content'], msg='更新後のWiki本文が不正') response2 = self.wiki.update_wiki_page( wiki_id=wiki_id, name=get_YYYYMMDDHHMMSS_name('wiki_updated2', now), content=basic_wiki_data['content'], mail_notify=basic_wiki_data['mail_notify'], ) self.assertTrue(response2.ok, msg='Wikiの2度目の更新に失敗')
def test_get_project_recent_updates(self): with self.assertRaises(ValueError, msg='プロジェクト活動状況の取得時、取得上限のルールのバリデーションに失敗'): self.project.get_project_recent_updates( project_id_or_key=str(self.project_id), count=0, order='asc', ) with self.assertRaises(ValueError, msg='プロジェクト活動状況の取得時、並び順のルールのバリデーションに失敗'): self.project.get_project_recent_updates( project_id_or_key=str(self.project_id), count=10, order='abc', ) response = self.project.get_project_recent_updates( project_id_or_key=str(self.project_id), count=10, order='asc', ) self.assertTrue(response.ok, msg='プロジェクト活動状況の取得に失敗') response_list = response_to_json(response) self.assertIsInstance(response_list, (list, dict), msg='プロジェクト活動状況の取得に失敗')
def test_custom_field(self): from pybacklogpy.Licence import Licence l = Licence() if response_to_json(l.get_licence())['licenceTypeId'] == 11: self.skipTest(reason='無料版ライセンスだとカスタム属性の設定ができない') now = datetime.now() response_list_field = self.custom_field.add_custom_field( project_id_or_key=self.project_key, type_id=CUSTOM_FIELD_TYPE['単一リスト'], name='test_custom_field_list_{YYMMDD}'.format(YYMMDD=now.strftime('%Y%m%d')), items=[ '要素1', '要素2', '要素3', ], allow_input=True, allow_add_item=True, ) self.assertTrue(response_list_field.ok, msg='単一リストカスタム属性の追加に失敗') list_field_id = response_to_json(response_list_field)['id'] response_update_list_field = self.custom_field.update_custom_field( project_id_or_key=self.project_key, custom_field_id=list_field_id, items=[ '要素4', '要素5', ], allow_input=False, allow_add_item=False, ) self.assertTrue(response_update_list_field.ok, msg='単一リストカスタム属性の更新に失敗') response_delete_list_field = self.custom_field.delete_custom_field( project_id_or_key=self.project_key, custom_field_id=list_field_id, ) self.assertTrue(response_delete_list_field.ok, msg='単一リストカスタム属性の削除に失敗') response_string_field = self.custom_field.add_custom_field( project_id_or_key=self.project_key, type_id=CUSTOM_FIELD_TYPE['文字列'], name='test_custom_field_string_{YYMMDD}'.format(YYMMDD=now.strftime('%Y%m%d')), ) self.assertTrue(response_string_field.ok, msg='文字列カスタム属性の追加に失敗') string_field_id = response_to_json(response_string_field)['id'] response_update_string_field = self.custom_field.update_custom_field( project_id_or_key=self.project_key, custom_field_id=string_field_id, name='updated name', ) self.assertTrue(response_update_string_field.ok, msg='文字列カスタム属性の更新に失敗') response_delete_string_field = self.custom_field.delete_custom_field( project_id_or_key=self.project_key, custom_field_id=string_field_id, ) self.assertTrue(response_delete_string_field.ok, msg='文字列カスタム属性の削除に失敗') response_number_filed = self.custom_field.add_custom_field( project_id_or_key=self.project_key, type_id=CUSTOM_FIELD_TYPE['数値'], name='test_custom_field_number_{YYMMDD}'.format(YYMMDD=now.strftime('%Y%m%d')), min_num=0, max_num=100, initial_value=50, unit='人月' ) self.assertTrue(response_number_filed.ok, msg='数値カスタム属性の追加に失敗') number_field_id = response_to_json(response_number_filed)['id'] response_update_number_filed = self.custom_field.update_custom_field( project_id_or_key=self.project_key, custom_field_id=number_field_id, min_num=1, max_num=99, initial_value=30, unit='年月' ) self.assertTrue(response_update_number_filed, msg='数値カスタム属性の更新に失敗') response_delete_number_filed = self.custom_field.delete_custom_field( project_id_or_key=self.project_key, custom_field_id=number_field_id, ) self.assertTrue(response_delete_number_filed.ok, msg='数値カスタム属性の削除に失敗') response_date_field = self.custom_field.add_custom_field( project_id_or_key=self.project_key, type_id=CUSTOM_FIELD_TYPE['日付'], name='test_custom_field_date_{YYMMDD}'.format(YYMMDD=now.strftime('%Y%m%d')), min_date='2016-01-01', max_date='2020-12-31', ) self.assertTrue(response_date_field.ok, msg='日付カスタム属性の追加に失敗') date_field_id = response_to_json(response_date_field)['id'] response_update_date_field = self.custom_field.update_custom_field( project_id_or_key=self.project_key, custom_field_id=date_field_id, min_date='2017-01-01', max_date='2019-12-31', ) self.assertTrue(response_update_date_field.ok, msg='日付カスタム属性の更新に失敗') response_delete_date_field = self.custom_field.delete_custom_field( project_id_or_key=self.project_key, custom_field_id=date_field_id, ) self.assertTrue(response_delete_date_field.ok, msg='日付カスタム属性の削除に失敗')
def test_get_space_disk_usage(self): response = self.space.get_space_disk_usage() self.assertTrue(response.ok, msg='スペースの容量使用状況の取得に失敗') response_dict = response_to_json(response) self.assertIsInstance(response_dict, dict, msg='スペースの容量使用状況取得のレスポンスが辞書でない')
def test_get_space_notification(self): response = self.space.get_space_notification() self.assertTrue(response.ok, msg='スペースのお知らせの取得に失敗') response_dict = response_to_json(response) self.assertIsInstance(response_dict, dict, msg='スペースのお知らせ取得のレスポンスが辞書でない')
def test_get_space(self): response = self.space.get_space() self.assertTrue(response.ok, msg='スペース情報の取得に失敗') response_dict = response_to_json(response) self.assertIsInstance(response_dict, dict, msg='スペース情報の取得に失敗') self.assertNotEqual(response_dict, {}, msg='スペース情報の取得に失敗')