コード例 #1
0
 def setUp(self):
     AvatarTestCase.setUp(self)
     self.avatar = CodehostingAvatar(self.aliceUserDict, None)
     # The logging system will try to get the id of avatar.transport, so
     # let's give it something to take the id of.
     self.avatar.transport = object()
     self.reactor = MockReactor()
     self.session = ExecOnlySession(self.avatar, self.reactor)
コード例 #2
0
 def test_environment(self):
     # The environment for the executed process can be specified in the
     # ExecOnlySession constructor.
     session = ExecOnlySession(self.avatar,
                               self.reactor,
                               environment={'FOO': 'BAR'})
     protocol = ProcessProtocol()
     session.execCommand(protocol, 'yes')
     self.assertEqual({'FOO': 'BAR'}, session.environment)
     self.assertEqual([(protocol, 'yes', ['yes'], {
         'FOO': 'BAR'
     }, None, None, None, 0, None)], self.reactor.log)