コード例 #1
0
    def test_action_gets_file_name_from_args(self):
        # given
        action = InitConfigAction()

        # when
        action.run(server_url='http://test.server.org',
                   username='******',
                   password='******',
                   params_file=self.config_file_path)

        # then
        self.assertTrue(os.path.exists(self.config_file_path))
コード例 #2
0
    def test_action_stores_given_password(self):
        # given
        password = '******'
        expected_config_part = 'PASSWORD = \'%s\'' % password
        action = InitConfigAction()

        # when
        action.run(server_url='http://test.server.org',
                   username='******',
                   password=password,
                   params_file=self.config_file_path)
        with open(self.config_file_path) as config_file:
            s = config_file.read()

        # then
        self.assertTrue(s.find(expected_config_part) > -1,
                        'Could not find configuration part for password %s'
                        % password)
コード例 #3
0
    def test_action_stores_given_server_url(self):
        # given
        server_url = 'http://test.server.org'
        expected_config_part = 'JENKINS_URL = \'%s\'' % server_url
        action = InitConfigAction()

        # when
        action.run(server_url=server_url,
                   username='******',
                   password='******',
                   params_file=self.config_file_path)
        with open(self.config_file_path) as config_file:
            s = config_file.read()

        # then
        self.assertTrue(s.find(expected_config_part) > -1,
                        'Could not find configuration for server URL %s'
                        % server_url)