示例#1
0
 def test_incorrect_is_target_path_with_type_and_section(self):
     type_name_and_sections = [
         ['soukatsu', 'zentai', 'houshin/zentai/1_zentai.tex'],
         ['soukatsu', 'zentai', 'soukatsu/kaikei/1_zentai.tex'],
         ['soukatsu', 'kaikei', 'hoishin/kaikei/1_zentai.tex'],
         ['soukatsu', 'kaikei', 'soukatsu/kensui/1_zentai.tex'],
         ['soukatsu', 'kensui', 'houshin/kensui/1_zentai.tex'],
         ['soukatsu', 'kensui', 'soukatsu/syogai/1_zentai.tex'],
         ['soukatsu', 'syogai', 'houshin/syogai/1_zentai.tex'],
         ['soukatsu', 'syogai', 'soukatsu/system/1_zentai.tex'],
         ['soukatsu', 'system', 'houshin/system/1_zentai.tex'],
         ['soukatsu', 'system', 'soukatsu/soumu/1_zentai.tex'],
         ['soukatsu', 'soumu', 'houshin/soumu/1_zentai.tex'],
         ['soukatsu', 'soumu', 'soukatsu/zentai/1_zentai.tex'],
         ['houshin', 'zentai', 'soukatsu/zentai/1_zentai.tex'],
         ['houshin', 'zentai', 'houshin/kaikei/1_zentai.tex'],
         ['houshin', 'kaikei', 'soukatsu/kaikei/1_zentai.tex'],
         ['houshin', 'kaikei', 'houshin/kensui/1_zentai.tex'],
         ['houshin', 'kensui', 'soukatsu/kensui/1_zentai.tex'],
         ['houshin', 'kensui', 'houshin/syogai/1_zentai.tex'],
         ['houshin', 'syogai', 'soukatsu/syogai/1_zentai.tex'],
         ['houshin', 'syogai', 'houshin/system/1_zentai.tex'],
         ['houshin', 'system', 'soukatsu/system/1_zentai.tex'],
         ['houshin', 'system', 'houshin/soumu/1_zentai.tex'],
         ['houshin', 'soumu', 'soukatsu/soumu/1_zentai.tex'],
         ['houshin', 'soumu', 'houshin/zentai/1_zentai.tex'],
     ]
     for type_name, section, target_path in type_name_and_sections:
         with self.subTest(type_name=type_name,
                           section=section,
                           target_path=target_path):
             self.assertFalse(
                 util.is_target_path(target_path, type_name, section))
def create_issues(*args) -> None:
    print(msg.GITHUB_INFO_INPUT_GUIDE)

    # Organization Nameを取得
    while True:
        try:
            organization_name: str = str(
                input(msg.ORGANIZATION_NAME_INPUT_GUIDE))

            # 結果表示
            print(msg.DELETE_LAST_LINE)
            print(msg.ORGANIZATION_NAME_INPUT_GUIDE + str(organization_name))

            # 未入力時デフォルト設定
            if organization_name == '':
                organization_name: str = config.GITHUB_ORGANIZATION

            break
        except:
            print(msg.ERROR_NOT_NUMBER)

    # Repository Nameを取得
    while True:
        try:
            repository_name: str = str(input(msg.REPOSITORY_NAME_INPUT_GUIDE))

            # 結果表示
            print(msg.DELETE_LAST_LINE)
            print(msg.REPOSITORY_NAME_INPUT_GUIDE + str(repository_name))

            break
        except:
            print(msg.ERROR_NOT_NUMBER)

    # PRIVATE-TOKENを取得
    while True:
        private_token: str = input(msg.PRIVATE_TOKEN_INPUT_GUIDE)

        if private_token != '':
            # 結果表示
            print(msg.DELETE_LAST_LINE)
            print(msg.PRIVATE_TOKEN_INPUT_GUIDE + private_token)

            break

        print(msg.ERROR_INPUT_EMPTY)

    # 既に作られたissueを取得
    created_issues: list = get_already_created_issues(organization_name,
                                                      repository_name,
                                                      private_token)
    created_issue_titles: list = get_created_issue_titles(created_issues)

    # 入力されたpathを元にissueを発行していく
    for path, assignee_info in assignees.assignees().items():
        if util.is_target_path(path, *args):
            create_issue(path, assignee_info, organization_name,
                         repository_name, private_token, created_issue_titles)
示例#3
0
 def test_correct_is_target_path_with_filepath(self):
     input_pathes = [
         ['./src/soukatsu', 'soukatsu/system/1_zentai.tex'],
         ['./src/soukatsu', 'soukatsu/1kai.tex'],
         ['./src/soukatsu/system', 'soukatsu/system/1_zentai.tex'],
         ['soukatsu/system', 'soukatsu/system/1_zentai.tex'],
     ]
     for input_path, target_path in input_pathes:
         with self.subTest(input_path=input_path, target_path=target_path):
             self.assertTrue(util.is_target_path(target_path, input_path))
示例#4
0
 def test_correct_is_target_path_with_type(self):
     type_names = [
         ['hajimeni', 'hajimeni.tex'],
         ['soukatsu', 'soukatsu/system/1_zentai.tex'],
         ['soukatsu', 'soukatsu/1kai.tex'],
         ['houshin', 'houshin/system/1_zentai.tex'],
         ['houshin', 'houshin/1kai.tex'],
     ]
     for type_name, target_path in type_names:
         with self.subTest(type_name=type_name, target_path=target_path):
             self.assertTrue(util.is_target_path(target_path, type_name))
示例#5
0
 def test_correct_is_target_path_with_no_args(self):
     target_pathes = [
         'hajimeni.tex',
         'soukatsu/1kai.tex',
         'soukatsu/system/1_zentai.tex',
         'houshin/1kai.tex',
         'houshin/system/1_zentai.tex',
     ]
     for target_path in target_pathes:
         with self.subTest(target_path=target_path):
             self.assertTrue(util.is_target_path(target_path, *[]))
示例#6
0
def create_issues(*args) -> None:
    print(msg.GITLAB_INFO_INPUT_GUIDE)

    # ProjectのIDを取得
    while True:
        try:
            project_id: int = int(input(msg.REPOSITORY_ID_INPUT_GUIDE))

            # 結果表示
            print(msg.DELETE_LAST_LINE)
            print(msg.REPOSITORY_ID_INPUT_GUIDE + str(project_id))

            break
        except:
            print(msg.ERROR_NOT_NUMBER)

    # PRIVATE-TOKENを取得
    while True:
        private_token: str = input(msg.PRIVATE_TOKEN_INPUT_GUIDE)

        if private_token != '':
            # 結果表示
            print(msg.DELETE_LAST_LINE)
            print(msg.PRIVATE_TOKEN_INPUT_GUIDE + private_token)

            break

        print(msg.ERROR_INPUT_EMPTY)

    # 既に作られたissueを取得
    created_issues: list = get_already_created_issues(project_id,
                                                      private_token)
    created_issue_titles: list = get_created_issue_titles(created_issues)

    # 入力されたpathを元にissueを発行していく
    for path, assignee_info in assignees.assignees().items():
        if util.is_target_path(path, *args):
            create_issue(path, assignee_info, project_id, private_token,
                         created_issue_titles)
def create_files(*args) -> None:
    for path, assignee_info in assignees.assignees().items():
        if util.is_target_path(path, *args):
            create_file(path, assignee_info)