Completed
Push — master ( 35635a...164fb4 )
by Piotr
01:08
created

test_app_not_run_without_valid_runner()   A

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
from unittest.mock import patch
2
3
import pytest
4
5
from mountapi.core.app import Application
6
from mountapi.core import exceptions
7
from mountapi.core.settings import AbstractSettings
8
9
10
class InvalidRouter:
11
    def __init__(self, router):
12
        self.router = router
13
14
15
class TestSettings(AbstractSettings):
16
    debug = False
17
    hostname = 'localhost'
18
    port = 8000
19
    router = 'mountapi.routing.Router'
20
    runner = 'mountapi.runners.Runner'
21
22
23
class InvalidRunnerTestSettings(AbstractSettings):
24
    debug = False
25
    hostname = 'localhost'
26
    port = 8000
27
    router = 'mountapi.routing.Router'
28
    runner = 'tests.test_app.InvalidRouter'
29
30
31
@patch('mountapi.runners.Runner.run')
32
def test_app_valid_with_valid_input(run_simple_mock):
33
    app = Application(TestSettings, routes=[])
34
    app.run()
35
36
37
@patch('mountapi.runners.Runner.run')
38
def test_app_not_run_without_valid_runner(run_simple_mock):
39
    with pytest.raises(exceptions.InvalidRunner):
40
        app = Application(InvalidRunnerTestSettings, routes=[])
41
        app.run()
42