Esempio n. 1
0
 def mock_svn_remote(self):
     return mocks.Requests('commits.webkit.org', **{
         'r49824/json': mocks.Response.fromJson(dict(
             identifier='5@main',
             revision=49824,
         )),
     })
Esempio n. 2
0
    def test_mark_bug_fixed(self):
        tool = MockTool()
        tool._scm.last_svn_commit_log = lambda: "r9876 |"
        options = Mock()
        options.bug_id = 50000
        options.comment = "MOCK comment"
        expected_logs = """Bug: <http://example.com/50000> Bug with two r+'d and cq+'d patches, one of which has an invalid commit-queue setter.
Revision: 9876
MOCK: user.open_url: http://example.com/50000
Is this correct?
Adding comment to Bug 50000.
MOCK bug comment: bug_id=50000, cc=None, see_also=None
--- Begin comment ---
MOCK comment

Committed r9876 (5@main): <https://commits.webkit.org/5@main>
--- End comment ---

"""
        with mocks.Requests(
                'commits.webkit.org', **{
                    'r9876/json':
                    mocks.Response.fromJson(
                        dict(
                            identifier='5@main',
                            revision=9876,
                        )),
                }):
            self.assert_execute_outputs(MarkBugFixed(), [],
                                        expected_logs=expected_logs,
                                        tool=tool,
                                        options=options)
Esempio n. 3
0
 def mock(cls):
     with mocks.Requests(
             cls.BUILD_MASTER,
             **{
                 'api/v2/builders': mocks.Response.fromJson(cls.BUILDERS),
                 'api/v2/workers': mocks.Response.fromJson(cls.WORKERS),
             },
     ):
         yield
Esempio n. 4
0
    def test_asynchronous(self):
        with mocks.Requests(
                'casserole.webkit.org',
                **{'api/cluster-endpoints':
                   mocks.Response(text='start')}), mocks.Time:
            nodes = CasseroleNodes(
                'https://casserole.webkit.org/api/cluster-endpoints',
                interval_seconds=10,
                asynchronous=True)
            self.assertEqual(['start'], nodes.nodes)

            with mocks.Requests(
                    'casserole.webkit.org', **{
                        'api/cluster-endpoints':
                        mocks.Response(text='url1,url2')
                    }):
                self.assertEqual(['start'], nodes.nodes)
                time.sleep(15)
                self.assertEqual(['url1', 'url2'], nodes.nodes)
Esempio n. 5
0
 def test_list_like(self):
     with mocks.Requests(
             'casserole.webkit.org', **{
                 'api/cluster-endpoints':
                 mocks.Response(text='url1,url2,url3')
             }):
         nodes = CasseroleNodes(
             'https://casserole.webkit.org/api/cluster-endpoints')
         self.assertEqual(['url1', 'url2', 'url3'],
                          [node for node in nodes])
         self.assertTrue(nodes)
         self.assertTrue('url1' in nodes)
Esempio n. 6
0
 def test_empty_state(self):
     with mocks.Requests('commits.webkit.org', **{
         'r49824/json': mocks.Response.fromJson(dict(
             identifier='5@main',
             revision=49824,
         )),
     }):
         step = CloseBugForLandDiff(MockTool(), MockOptions())
         with OutputCapture(level=logging.INFO) as captured:
             step.run(dict(commit_text='Mock commit text'))
         self.assertEqual(
             captured.root.log.getvalue(),
             'Committed r49824 (5@main): <https://commits.webkit.org/5@main>\nNo bug id provided.\n'
         )
Esempio n. 7
0
 def test_fallback(self):
     with mocks.Requests('webkit.org'):
         with mocks.Requests('bugs.webkit.org'):
             self.assertEqual(
                 requests.get('https://webkit.org').status_code, 404)
Esempio n. 8
0
 def test_basic(self):
     with mocks.Requests('webkit.org'):
         self.assertEqual(
             requests.get('https://webkit.org').status_code, 404)