Completed
Push — master ( f1a13c...e53aa3 )
by Tomaz
20s
created

GetDiscoveryProgressTestCase   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B test_run_discovery_status_to_text() 0 27 1
1
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
15
# from mock import MagicMock
16
17
from orion_base_action_test_case import OrionBaseActionTestCase
18
19
from get_discovery_progress import GetDiscoveryProgress
20
from lib.utils import discovery_status_to_text
21
22
23
__all__ = [
24
    'GetDiscoveryProgressTestCase'
25
]
26
27
28
class GetDiscoveryProgressTestCase(OrionBaseActionTestCase):
29
    __test__ = True
30
    action_cls = GetDiscoveryProgress
31
32
    def test_run_discovery_status_to_text(self):
33
        status = discovery_status_to_text("0")
34
        self.assertEqual(status, "Unknown")
35
36
        status = discovery_status_to_text("1")
37
        self.assertEqual(status, "InProgress")
38
39
        status = discovery_status_to_text("2")
40
        self.assertEqual(status, "Finished")
41
42
        status = discovery_status_to_text("3")
43
        self.assertEqual(status, "Error")
44
45
        status = discovery_status_to_text("4")
46
        self.assertEqual(status, "NotScheduled")
47
48
        status = discovery_status_to_text("5")
49
        self.assertEqual(status, "Scheduled")
50
51
        status = discovery_status_to_text("6")
52
        self.assertEqual(status, "NotCompleted")
53
54
        status = discovery_status_to_text("7")
55
        self.assertEqual(status, "Canceling")
56
57
        status = discovery_status_to_text("8")
58
        self.assertEqual(status, "ReadyForImport")
59
60
    # FIXME This needs more tests....
61
    # def test_run_response_processed(self):
62
    #    pass
63