def setUp(self):
    SuperMoxTestBase.setUp(self)

    self.fake_file_name = 'fake.css'

    self.fake_file = self.mox.CreateMockAnything()
    self.mox.StubOutWithMock(self.fake_file, 'LocalPath')
    self.fake_file.LocalPath().AndReturn(self.fake_file_name)
    # Actual calls to NewContents() are defined in each test.
    self.mox.StubOutWithMock(self.fake_file, 'NewContents')

    self.input_api = self.mox.CreateMockAnything()
    self.input_api.re = re
    self.mox.StubOutWithMock(self.input_api, 'AffectedSourceFiles')
    self.input_api.AffectedFiles(
        include_deletes=False, file_filter=None).AndReturn([self.fake_file])

    # Actual creations of PresubmitPromptWarning are defined in each test.
    self.output_api = self.mox.CreateMockAnything()
    self.mox.StubOutWithMock(self.output_api, 'PresubmitPromptWarning',
                             use_mock_anything=True)

    self.output_api = self.mox.CreateMockAnything()
    self.mox.StubOutWithMock(self.output_api, 'PresubmitNotifyResult',
                             use_mock_anything=True)
  def setUp(self):
    SuperMoxTestBase.setUp(self)

    input_api = self.mox.CreateMockAnything()
    input_api.re = re
    output_api = self.mox.CreateMockAnything()
    self.checker = resource_checker.ResourceChecker(input_api, output_api)
Beispiel #3
0
  def setUp(self):
    SuperMoxTestBase.setUp(self)

    self.fake_file_name = 'fake.css'

    self.fake_file = self.mox.CreateMockAnything()
    self.mox.StubOutWithMock(self.fake_file, 'LocalPath')
    self.fake_file.LocalPath().AndReturn(self.fake_file_name)
    # Actual calls to NewContents() are defined in each test.
    self.mox.StubOutWithMock(self.fake_file, 'NewContents')

    self.input_api = self.mox.CreateMockAnything()
    self.input_api.re = re
    self.mox.StubOutWithMock(self.input_api, 'AffectedSourceFiles')
    self.input_api.AffectedFiles(
        include_deletes=False, file_filter=None).AndReturn([self.fake_file])

    # Actual creations of PresubmitPromptWarning are defined in each test.
    self.output_api = self.mox.CreateMockAnything()
    self.mox.StubOutWithMock(self.output_api, 'PresubmitPromptWarning',
                             use_mock_anything=True)

    author_msg = ('Was the CSS checker useful? '
                  'Send feedback or hate mail to [email protected].')
    self.output_api = self.mox.CreateMockAnything()
    self.mox.StubOutWithMock(self.output_api, 'PresubmitNotifyResult',
                             use_mock_anything=True)
    self.output_api.PresubmitNotifyResult(author_msg).AndReturn(None)
Beispiel #4
0
 def setUp(self):
   SuperMoxTestBase.setUp(self)
   self.fake_root_dir = self.RootDir()
   self.mox.StubOutWithMock(gcl, 'RunShell')
   self.mox.StubOutWithMock(gcl.SVN, '_CaptureInfo')
   self.mox.StubOutWithMock(gcl.SVN, 'GetCheckoutRoot')
   self.mox.StubOutWithMock(gcl, 'tempfile')
   self.mox.StubOutWithMock(gcl.upload, 'RealMain')
   self.mox.StubOutWithMock(gcl.gclient_utils, 'FileRead')
   self.mox.StubOutWithMock(gcl.gclient_utils, 'FileWrite')
   gcl.REPOSITORY_ROOT = None
   self.old_review_settings = gcl.CODEREVIEW_SETTINGS
   self.assertEquals(gcl.CODEREVIEW_SETTINGS, {})
Beispiel #5
0
 def setUp(self):
   SuperMoxTestBase.setUp(self)
   self.mox.StubOutWithMock(auto_roll.rietveld.Rietveld, 'add_comment')
   self.mox.StubOutWithMock(auto_roll.rietveld.Rietveld, 'close_issue')
   self.mox.StubOutWithMock(auto_roll.rietveld.Rietveld,
                            'get_issue_properties')
   self.mox.StubOutWithMock(auto_roll.rietveld.Rietveld, 'search')
   self.mox.StubOutWithMock(auto_roll.scm.GIT, 'Capture')
   self.mox.StubOutWithMock(auto_roll.subprocess2, 'check_call')
   self.mox.StubOutWithMock(auto_roll.subprocess2, 'check_output')
   self.mox.StubOutWithMock(auto_roll.urllib2, 'urlopen')
   auto_roll.datetime.datetime = self.MockDateTime
   auto_roll.rietveld.upload.HttpRpcServer = self.MockHttpRpcServer
   self._arb = auto_roll.AutoRoller(self.TEST_PROJECT,
                                    self.TEST_AUTHOR,
                                    self.PATH_TO_CHROME)
  def setUp(self):
    SuperMoxTestBase.setUp(self)

    input_api = self.mox.CreateMockAnything()
    input_api.os_path = os_path
    input_api.re = re

    input_api.change = self.mox.CreateMockAnything()
    self.mox.StubOutWithMock(input_api.change, 'RepositoryRoot')
    src_root = os_path.join(os_path.dirname(__file__), '..', '..', '..')
    input_api.change.RepositoryRoot().MultipleTimes().AndReturn(src_root)

    output_api = self.mox.CreateMockAnything()

    self.mox.ReplayAll()

    self.checker = js_checker.JSChecker(input_api, output_api)
 def setUp(self):
   SuperMoxTestBase.setUp(self)
   self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'CheckCallAndFilter')
   self.mox.StubOutWithMock(gclient_scm.gclient_utils,
       'CheckCallAndFilterAndHeader')
   self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileRead')
   self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileWrite')
   self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'RemoveDirectory')
   self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'Capture')
   self.mox.StubOutWithMock(gclient_scm.scm.SVN, '_CaptureInfo')
   self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'CaptureStatus')
   self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'RunAndGetFileList')
   self.mox.StubOutWithMock(subprocess2, 'communicate')
   self.mox.StubOutWithMock(subprocess2, 'Popen')
   self._scm_wrapper = gclient_scm.CreateSCM
   gclient_scm.scm.SVN.current_version = None
   # Absolute path of the fake checkout directory.
   self.base_path = join(self.root_dir, self.relpath)
 def setUp(self):
   SuperMoxTestBase.setUp(self)
   self.mox.StubOutWithMock(subprocess2, 'communicate')
   self.mox.StubOutWithMock(trychange, 'RunGit')
   self.mox.StubOutWithMock(trychange.scm.GIT, 'Capture')
   self.mox.StubOutWithMock(trychange.scm.GIT, 'GenerateDiff')
   self.mox.StubOutWithMock(trychange.scm.GIT, 'GetCheckoutRoot')
   self.mox.StubOutWithMock(trychange.scm.GIT, 'GetEmail')
   self.mox.StubOutWithMock(trychange.scm.GIT, 'GetPatchName')
   self.mox.StubOutWithMock(trychange.scm.GIT, 'GetUpstreamBranch')
   self.mox.StubOutWithMock(trychange.scm.SVN, 'GenerateDiff')
   self.mox.StubOutWithMock(trychange.scm.SVN, 'GetCheckoutRoot')
   self.mox.StubOutWithMock(trychange.scm.SVN, 'GetEmail')
   self.fake_root = self.Dir()
   self.expected_files = ['foo.txt', 'bar.txt']
   self.options = trychange.optparse.Values()
   self.options.files = self.expected_files
   self.options.diff = None
   self.options.name = None
   self.options.email = None
   self.options.exclude = []
Beispiel #9
0
 def setUp(self):
     SuperMoxTestBase.setUp(self)
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, "CheckCallAndFilter")
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, "CheckCallAndFilterAndHeader")
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, "FileRead")
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, "FileWrite")
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, "RemoveDirectory")
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, "Capture")
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, "_CaptureInfo")
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, "CaptureStatus")
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, "RunAndGetFileList")
     self.mox.StubOutWithMock(subprocess2, "communicate")
     self.mox.StubOutWithMock(subprocess2, "Popen")
     self._scm_wrapper = gclient_scm.CreateSCM
     gclient_scm.scm.SVN.current_version = None
     self._original_SVNBinaryExists = gclient_scm.SVNWrapper.BinaryExists
     self._original_GitBinaryExists = gclient_scm.GitWrapper.BinaryExists
     gclient_scm.SVNWrapper.BinaryExists = staticmethod(lambda: True)
     gclient_scm.GitWrapper.BinaryExists = staticmethod(lambda: True)
     # Absolute path of the fake checkout directory.
     self.base_path = join(self.root_dir, self.relpath)
 def setUp(self):
     SuperMoxTestBase.setUp(self)
     self.mox.StubOutWithMock(gclient_scm.gclient_utils,
                              'CheckCallAndFilter')
     self.mox.StubOutWithMock(gclient_scm.gclient_utils,
                              'CheckCallAndFilterAndHeader')
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileRead')
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileWrite')
     self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'rmtree')
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'Capture')
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, '_CaptureInfo')
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'CaptureStatus')
     self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'RunAndGetFileList')
     self.mox.StubOutWithMock(subprocess2, 'communicate')
     self.mox.StubOutWithMock(subprocess2, 'Popen')
     self._scm_wrapper = gclient_scm.CreateSCM
     gclient_scm.scm.SVN.current_version = None
     self._original_SVNBinaryExists = gclient_scm.SVNWrapper.BinaryExists
     self._original_GitBinaryExists = gclient_scm.GitWrapper.BinaryExists
     gclient_scm.SVNWrapper.BinaryExists = staticmethod(lambda: True)
     gclient_scm.GitWrapper.BinaryExists = staticmethod(lambda: True)
     # Absolute path of the fake checkout directory.
     self.base_path = join(self.root_dir, self.relpath)
 def tearDown(self):
     self.mox.UnsetStubs()
     SuperMoxTestBase.tearDown(self)
 def setUp(self):
     SuperMoxTestBase.setUp(self)
     self.input_api = self.mox.CreateMockAnything()
     self.input_api.os_path = os.path
     self.input_api.change = self.mox.CreateMockAnything()
     self.input_api.change.RepositoryRoot = lambda: ''
 def setUp(self):
   SuperMoxTestBase.setUp(self)
   self.input_api = self.mox.CreateMockAnything()
   self.input_api.re = re
   self.input_api.os_path = os.path
 def tearDown(self):
   self.mox.UnsetStubs()
   SuperMoxTestBase.tearDown(self)
Beispiel #15
0
 def setUp(self):
   SuperMoxTestBase.setUp(self)
Beispiel #16
0
 def tearDown(self):
   SuperMoxTestBase.tearDown(self)
   gclient_scm.SVNWrapper.BinaryExists = self._original_SVNBinaryExists
   gclient_scm.GitWrapper.BinaryExists = self._original_GitBinaryExists
Beispiel #17
0
 def tearDown(self):
   SuperMoxTestBase.tearDown(self)
 def setUp(self):
     SuperMoxTestBase.setUp(self)
     self.input_api = self.mox.CreateMockAnything()
     self.input_api.re = re
     self.input_api.os_path = os.path
 def setUp(self):
   SuperMoxTestBase.setUp(self)
   self.input_api = self.mox.CreateMockAnything()
   self.input_api.os_path = os.path
   self.input_api.change = self.mox.CreateMockAnything()
   self.input_api.change.RepositoryRoot = lambda: ''
Beispiel #20
0
 def tearDown(self):
   SuperMoxTestBase.tearDown(self)
   gclient_scm.SVNWrapper.BinaryExists = self._original_SVNBinaryExists
   gclient_scm.GitWrapper.BinaryExists = self._original_GitBinaryExists
 def setUp(self):
     SuperMoxTestBase.setUp(self)
 def tearDown(self):
     SuperMoxTestBase.tearDown(self)