def setUp(self):
     self.receiver = StatusReporter()
     self.sender = StatusReporter(duplicate_reporter=self.receiver)
class TestStatusReporter(ScalyrTestCase):
    def setUp(self):
        self.receiver = StatusReporter()
        self.sender = StatusReporter(duplicate_reporter=self.receiver)

    def tearDown(self):
        self.receiver.close()
        self.sender.close()

    def test_basic_status(self):
        self.sender.report_status('My status')
        self.assertEquals(self.receiver.read_status(timeout=5.0), 'My status')

    def test_status_with_newlines(self):
        self.sender.report_status('My status\nAnother one\n')
        self.assertEquals(self.receiver.read_status(timeout=5.0), 'My status\nAnother one\n')

    def test_timeout_exceeded(self):
        self.assertEquals(self.receiver.read_status(timeout=0.0, timeout_status='timeout'), 'timeout')

    def test_no_timeout(self):
        self.sender.report_status('My status')
        self.assertEquals(self.receiver.read_status(), 'My status')
Exemple #3
0
class TestStatusReporter(ScalyrTestCase):
    def setUp(self):
        super(TestStatusReporter, self).setUp()
        self.receiver = StatusReporter()
        self.sender = StatusReporter(duplicate_reporter=self.receiver)

    def tearDown(self):
        self.receiver.close()
        self.sender.close()

    def test_basic_status(self):
        self.sender.report_status("My status")
        self.assertEquals(self.receiver.read_status(timeout=5.0), "My status")

    def test_status_with_newlines(self):
        self.sender.report_status("My status\nAnother one\n")
        self.assertEquals(self.receiver.read_status(timeout=5.0),
                          "My status\nAnother one\n")

    def test_timeout_exceeded(self):
        self.assertEquals(
            self.receiver.read_status(timeout=0.0, timeout_status="timeout"),
            "timeout")

    def test_no_timeout(self):
        self.sender.report_status("My status")
        self.assertEquals(self.receiver.read_status(), "My status")
Exemple #4
0
 def setUp(self):
     super(TestStatusReporter, self).setUp()
     self.receiver = StatusReporter()
     self.sender = StatusReporter(duplicate_reporter=self.receiver)
Exemple #5
0
 def setUp(self):
     self.receiver = StatusReporter()
     self.sender = StatusReporter(duplicate_reporter=self.receiver)