Пример #1
0
 def test_no_p4branch_with_no_p4base_step_config(self):
     with self.assertRaises(config.ConfigErrors):
         P4(p4branch='blah')
Пример #2
0
 def test_no_p4extra_views_with_no_p4base_step_config(self):
     with self.assertRaises(config.ConfigErrors):
         P4(p4extra_views='blah')
Пример #3
0
 def test_no_p4viewspec_is_string_step_config(self):
     with self.assertRaises(config.ConfigErrors):
         P4(p4viewspec='a_bad_idea')
Пример #4
0
 def test_no_p4branch_has_trailing_slash_step_config(self):
     with self.assertRaises(config.ConfigErrors):
         P4(p4base='//depot', p4branch='blah/')
Пример #5
0
 def test_no_empty_step_config(self):
     with self.assertRaises(config.ConfigErrors):
         P4()
Пример #6
0
 def test_no_multiple_type_step_config(self):
     with self.assertRaises(config.ConfigErrors):
         P4(p4viewspec=('//depot/trunk', ''), p4base='//depot',
         p4branch='trunk', p4extra_views=['src', 'doc'])
Пример #7
0
 def test_incorrect_mode(self):
     with self.assertRaises(config.ConfigErrors):
         P4(p4base='//depot', mode='invalid')
Пример #8
0
    def test_ticket_auth(self):
        self.setupStep(
            P4(p4port='localhost:12000',
               p4base='//depot',
               p4branch='trunk',
               p4user='******',
               p4client='p4_client1',
               p4passwd='pass',
               use_tickets=True))

        root_dir = '/home/user/workspace/wkdir'
        if _is_windows:
            root_dir = r'C:\Users\username\Workspace\wkdir'
        client_spec = textwrap.dedent('''\
        Client: p4_client1

        Owner: user

        Description:
        \tCreated by user

        Root:\t%s

        Options:\tallwrite rmdir

        LineEnd:\tlocal

        View:
        \t//depot/trunk/... //p4_client1/...
        ''' % root_dir)

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['p4', '-V']) + 0,

            # This is the extra step that gets run when using tickets,
            # and the password is not passed anymore after that.
            ExpectShell(workdir='wkdir',
                        command=[
                            'p4', '-p', 'localhost:12000', '-u', 'user', '-c',
                            'p4_client1', 'login'
                        ],
                        initialStdin='pass\n') + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'p4', '-p', 'localhost:12000', '-u', 'user', '-c',
                            'p4_client1', 'client', '-i'
                        ],
                        initialStdin=client_spec) + 0,
            ExpectShell(workdir='wkdir',
                        command=([
                            'p4', '-p', 'localhost:12000', '-u', 'user', '-c',
                            'p4_client1', 'sync'
                        ])) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'p4', '-p', 'localhost:12000', '-u', 'user', '-c',
                            'p4_client1', 'changes', '-m1', '#have'
                        ]) +
            ExpectShell.log(
                'stdio',
                stdout="Change 100 on 2013/03/21 by user@machine \'duh\'") + 0,
        )
        self.expectOutcome(result=SUCCESS)
        return self.runStep()
Пример #9
0
    def test_mode_incremental_p4base_with_revision(self):
        self.setupStep(
            P4(p4port='localhost:12000',
               mode='incremental',
               p4base='//depot',
               p4branch='trunk',
               p4user='******',
               p4client='p4_client1',
               p4passwd='pass'), dict(revision='100', ))

        root_dir = '/home/user/workspace/wkdir'
        if _is_windows:
            root_dir = r'C:\Users\username\Workspace\wkdir'
        client_spec = textwrap.dedent('''\
        Client: p4_client1

        Owner: user

        Description:
        \tCreated by user

        Root:\t%s

        Options:\tallwrite rmdir

        LineEnd:\tlocal

        View:
        \t//depot/trunk/... //p4_client1/...
        ''' % root_dir)

        self.expectCommands(
            ExpectShell(
                workdir=
                'wkdir',  # defaults to this, only changes if it has a copy mode.
                command=['p4', '-V'])  # expected remote command
            + 0,  # expected exit status
            ExpectShell(workdir='wkdir',
                        command=[
                            'p4', '-p', 'localhost:12000', '-u', 'user', '-P',
                            ('obfuscated', 'pass', 'XXXXXX'), '-c',
                            'p4_client1', 'client', '-i'
                        ],
                        initialStdin=client_spec) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'p4', '-p', 'localhost:12000', '-u', 'user', '-P',
                            ('obfuscated', 'pass', 'XXXXXX'), '-c',
                            'p4_client1', 'sync', '//depot...@100'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'p4', '-p', 'localhost:12000', '-u', 'user', '-P',
                            ('obfuscated', 'pass', 'XXXXXX'), '-c',
                            'p4_client1', 'changes', '-m1', '#have'
                        ]) +
            ExpectShell.log(
                'stdio',
                stdout="Change 100 on 2013/03/21 by user@machine \'duh\'") + 0,
        )
        self.expectOutcome(result=SUCCESS)
        self.expectProperty('got_revision', '100', 'P4')
        return self.runStep()
Пример #10
0
 def test_no_p4base_has_trailing_slash_step_config(self):
     self.assertRaises(config.ConfigErrors, lambda: P4(p4base='//depot/'))
Пример #11
0
 def test_no_empty_step_config(self):
     self.assertRaises(config.ConfigErrors, lambda: P4())