コード例 #1
0
class TestLogTask(object):
    """Test LogTask.

    """
    def setup(self):
        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = LogTask(name='Test')
        self.root.add_child_task(0, self.task)

    def test_check1(self):
        """Test checking that a message that cannot be formatted will result in a fail

        """
        self.task.message = 'TestMessage {aa}'

        test, traceback = self.task.check()

        assert not test
        assert len(traceback) == 1
        assert 'root/Test-message' in traceback
        assert not self.task.get_from_database('Test_message')

    def test_perform1(self):
        """Test checking that the message value gets written to the database

        """
        self.task.write_in_database('val', 'World')
        self.task.message = 'Hello {Test_val}'
        self.root.prepare()

        self.task.perform()
        assert self.task.get_from_database('Test_message') == 'Hello World'
コード例 #2
0
ファイル: test_log_task.py プロジェクト: PhilipVinc/ecpy
class TestLogTask(object):
    """Test LogTask.

    """

    def setup(self):
        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = LogTask(name='Test')
        self.root.add_child_task(0, self.task)

    def test_check1(self):
        """Test checking that a message that cannot be formatted will result in a fail

        """
        self.task.message = 'TestMessage {aa}'

        test, traceback = self.task.check()

        assert not test
        assert len(traceback) == 1
        assert 'root/Test-message' in traceback
        assert not self.task.get_from_database('Test_message')

    def test_perform1(self):
        """Test checking that the message value gets written to the database

        """
        self.task.write_in_database('val', 'World')
        self.task.message = 'Hello {Test_val}'
        self.root.prepare()

        self.task.perform()
        assert self.task.get_from_database('Test_message') == 'Hello World'
コード例 #3
0
def test_view(windows):
    """Test the LogTask view.

    """
    show_and_close_widget(LogView(task=LogTask(name='Test')))
コード例 #4
0
 def setup(self):
     self.root = RootTask(should_stop=Event(), should_pause=Event())
     self.task = LogTask(name='Test')
     self.root.add_child_task(0, self.task)
コード例 #5
0
ファイル: test_log_task.py プロジェクト: PhilipVinc/ecpy
 def setup(self):
     self.root = RootTask(should_stop=Event(), should_pause=Event())
     self.task = LogTask(name='Test')
     self.root.add_child_task(0, self.task)