Completed
Push — master ( e004f0...1a0efd )
by Daniel
01:07
created

test_thread_run()   A

Complexity

Conditions 4

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 4
c 1
b 1
f 0
dl 0
loc 8
rs 9.2
1
import pytest
2
from groundwork.patterns.gw_threads_pattern import ThreadExistsException
3
4
5
def test_thread_plugin_activation(basicApp):
6
    plugin = basicApp.plugins.get("ThreadPlugin")
7
    assert plugin is not None
8
    assert plugin.active is True
9
10
11
def test_thread_run(basicApp):
12
    plugin = basicApp.plugins.get("ThreadPlugin")
13
    thread = plugin.threads.get("test_thread")
14
    assert thread is not None
15
    thread.run()
16
    while thread.running:
17
        pass
18
    assert thread.response == "Done"
19
20
21
def test_thread_exists(basicApp):
22
    plugin = basicApp.plugins.get("ThreadPlugin")
23
    with pytest.raises(ThreadExistsException):
24
        plugin.threads.register("test_thread", None)
25