예제 #1
0
    def test_print_current_codecommit_settings__codecommit_is_setup(
            self, echo_mock, get_default_repository_mock,
            get_default_branch_mock):
        get_default_branch_mock.return_value = False
        get_default_repository_mock.return_value = True
        self.assertTrue(gitops.print_current_codecommit_settings())
        echo_mock.assert_has_calls([
            mock.call('Current CodeCommit setup:'),
            mock.call('  Repository: True'),
            mock.call('  Branch: False')
        ])
        echo_mock.reset_mock()

        get_default_branch_mock.return_value = True
        get_default_repository_mock.return_value = False
        self.assertTrue(gitops.print_current_codecommit_settings())
        echo_mock.assert_has_calls([
            mock.call('Current CodeCommit setup:'),
            mock.call('  Repository: False'),
            mock.call('  Branch: True')
        ])
        echo_mock.reset_mock()

        get_default_branch_mock.return_value = True
        get_default_repository_mock.return_value = True
        self.assertTrue(gitops.print_current_codecommit_settings())
        echo_mock.assert_has_calls([
            mock.call('Current CodeCommit setup:'),
            mock.call('  Repository: True'),
            mock.call('  Branch: True')
        ])
예제 #2
0
 def prompt_for_codesource(self):
     gitops.print_current_codecommit_settings()
     io.echo(prompts['codesource.codesourceprompt'])
     setup_choices = ['CodeCommit', 'Local']
     choice = utils.prompt_for_item_in_list(setup_choices, 2)
     if choice == setup_choices[0]:
         self.set_codecommit()
     elif choice == setup_choices[1]:
         self.set_local()
예제 #3
0
 def do_command(self):
     sourcename = self.app.pargs.sourcename
     if sourcename is not None:
         if sourcename == 'local':
             gitops.print_current_codecommit_settings()
             self.set_local()
         if sourcename == 'codecommit':
             self.set_codecommit()
     else:
         self.prompt_for_codesource()
예제 #4
0
 def test_print_current_codecommit_settings__codecommit_not_setup(
         self, echo_mock, get_default_repository_mock,
         get_default_branch_mock):
     get_default_branch_mock.return_value = False
     get_default_repository_mock.return_value = False
     self.assertFalse(gitops.print_current_codecommit_settings())
     echo_mock.assert_not_called()