Пример #1
0
 def test_apply_exportable_commits_locally(self):
     host = MockHost()
     importer = TestImporter(host, wpt_github=MockWPTGitHub(pull_requests=[]))
     fake_commit = MockChromiumCommit(
         host, subject='My fake commit',
         patch=(
             'Fake patch contents...\n'
             '--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/outline-004.html\n'
             '+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/outline-004.html\n'
             '@@ -20,7 +20,7 @@\n'
             '...'))
     importer.exportable_but_not_exported_commits = lambda _: [fake_commit]
     applied = importer.apply_exportable_commits_locally(LocalWPT(host))
     self.assertEqual(applied, [fake_commit])
     self.assertEqual(host.executive.full_calls, [
         MockCall(
             ['git', 'apply', '-'],
             {
                 'input': (
                     'Fake patch contents...\n'
                     '--- a/css/css-ui-3/outline-004.html\n'
                     '+++ b/css/css-ui-3/outline-004.html\n'
                     '@@ -20,7 +20,7 @@\n'
                     '...'),
                 'cwd': '/tmp/wpt',
                 'env': None
             }),
         MockCall(
             ['git', 'add', '.'],
             kwargs={'input': None, 'cwd': '/tmp/wpt', 'env': None}),
         MockCall(
             ['git', 'commit', '--all', '-F', '-'],
             kwargs={'cwd': '/tmp/wpt', 'env': None})
     ])
Пример #2
0
 def test_apply_exportable_commits_locally(self):
     # TODO(robertma): Consider using MockLocalWPT.
     host = MockHost()
     importer = TestImporter(host,
                             wpt_github=MockWPTGitHub(pull_requests=[]))
     importer.wpt_git = MockGit(cwd='/tmp/wpt', executive=host.executive)
     fake_commit = MockChromiumCommit(
         host,
         subject='My fake commit',
         patch=
         ('Fake patch contents...\n'
          '--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/outline-004.html\n'
          '+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/outline-004.html\n'
          '@@ -20,7 +20,7 @@\n'
          '...'))
     importer.exportable_but_not_exported_commits = lambda _: [fake_commit]
     applied = importer.apply_exportable_commits_locally(LocalWPT(host))
     self.assertEqual(applied, [fake_commit])
     # This assertion is implementation details of LocalWPT.apply_patch.
     # TODO(robertma): Move this to local_wpt_unittest.py.
     self.assertEqual(host.executive.full_calls, [
         MockCall(
             ['git', 'apply', '-'], {
                 'input': ('Fake patch contents...\n'
                           '--- a/css/css-ui-3/outline-004.html\n'
                           '+++ b/css/css-ui-3/outline-004.html\n'
                           '@@ -20,7 +20,7 @@\n'
                           '...'),
                 'cwd':
                 '/tmp/wpt',
                 'env':
                 None
             }),
         MockCall(['git', 'add', '.'],
                  kwargs={
                      'input': None,
                      'cwd': '/tmp/wpt',
                      'env': None
                  })
     ])
     self.assertEqual(
         importer.wpt_git.local_commits(),
         [['Applying patch 14fd77e88e42147c57935c49d9e3b2412b8491b7']])