def test_cl_description_with_empty_environ(self): host = MockHost() host.executive = MockExecutive2(output="Last commit message\n") updater = DepsUpdater(host) description = updater._cl_description() self.assertEqual(description, ("Last commit message\n" "[email protected]\n" "NOEXPORT=true")) self.assertEqual(host.executive.calls, [["git", "log", "-1", "--format=%B"]])
def test_cl_description_with_empty_environ(self): host = MockHost() host.executive = MockExecutive2(output='Last commit message\n') updater = DepsUpdater(host) description = updater._cl_description() self.assertEqual(description, ('Last commit message\n' '[email protected]')) self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=%B']])
def test_cl_description_with_environ_variables(self): host = MockHost() host.executive = MockExecutive2(output='Last commit message\n') updater = DepsUpdater(host) updater.host.environ['BUILDBOT_MASTERNAME'] = 'my.master' updater.host.environ['BUILDBOT_BUILDERNAME'] = 'b' updater.host.environ['BUILDBOT_BUILDNUMBER'] = '123' description = updater._cl_description() self.assertEqual(description, ( 'Last commit message\n' 'Build: https://build.chromium.org/p/my.master/builders/b/builds/123\n\n' '[email protected]')) self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=%B']])
def test_cl_description_with_environ_variables(self): host = MockHost() host.executive = MockExecutive2(output="Last commit message\n") updater = DepsUpdater(host) updater.host.environ["BUILDBOT_MASTERNAME"] = "my.master" updater.host.environ["BUILDBOT_BUILDERNAME"] = "b" updater.host.environ["BUILDBOT_BUILDNUMBER"] = "123" description = updater._cl_description() self.assertEqual( description, ( "Last commit message\n" "Build: https://build.chromium.org/p/my.master/builders/b/builds/123\n\n" "[email protected]\n" "NOEXPORT=true" ), ) self.assertEqual(host.executive.calls, [["git", "log", "-1", "--format=%B"]])