• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geopython / pywps / 6720056456

01 Nov 2023 01:06PM UTC coverage: 84.061% (+2.7%) from 81.332%
6720056456

push

github

web-flow
fix tests (#687)



* skip py37

5374 of 6393 relevant lines covered (84.06%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.96
/tests/test_process.py
1
##################################################################
2
# Copyright 2018 Open Source Geospatial Foundation and others    #
3
# licensed under MIT, Please consult LICENSE.txt for details     #
4
##################################################################
5

6
"""Test process
1✔
7
"""
8

9
from basic import TestBase
1✔
10

11
from pywps import Process
1✔
12
from pywps.app.Common import Metadata
1✔
13
from pywps.inout import LiteralInput
1✔
14
from pywps.inout import BoundingBoxInput
1✔
15
from pywps.inout import ComplexInput
1✔
16
from pywps.inout import FORMATS
1✔
17
from pywps.translations import get_translation
1✔
18

19

20
class DoNothing(Process):
1✔
21
    def __init__(self):
1✔
22
        super(DoNothing, self).__init__(
1✔
23
            self.donothing,
24
            "process",
25
            title="Process",
26
            abstract="Process description",
27
            inputs=[LiteralInput("length", title="Length"),
28
                    BoundingBoxInput("bbox", title="BBox", crss=[]),
29
                    ComplexInput("vector", title="Vector", supported_formats=[FORMATS.GML])],
30
            outputs=[],
31
            metadata=[Metadata('process metadata 1', 'http://example.org/1'),
32
                      Metadata('process metadata 2', 'http://example.org/2')],
33
            translations={"fr-CA": {"title": "Processus", "abstract": "Une description"}}
34
        )
35

36
    @staticmethod
1✔
37
    def donothing(request, response):
1✔
38
        pass
×
39

40

41
class ProcessTestCase(TestBase):
1✔
42

43
    def setUp(self):
1✔
44
        super().setUp()
1✔
45
        self.process = DoNothing()
1✔
46

47
    def test_get_input_title(self):
1✔
48
        """Test returning the proper input title"""
49

50
        inputs = {
1✔
51
            input.identifier: input.title for input in self.process.inputs
52
        }
53
        self.assertEqual("Length", inputs['length'])
1✔
54
        self.assertEqual("BBox", inputs["bbox"])
1✔
55
        self.assertEqual("Vector", inputs["vector"])
1✔
56

57
    def test_json(self):
1✔
58
        new_process = Process.from_json(self.process.json)
1✔
59
        self.assertEqual(new_process.identifier, self.process.identifier)
1✔
60
        self.assertEqual(new_process.title, self.process.title)
1✔
61
        self.assertEqual(len(new_process.inputs), len(self.process.inputs))
1✔
62
        new_inputs = {
1✔
63
            inpt.identifier: inpt.title for inpt in new_process.inputs
64
        }
65
        self.assertEqual("Length", new_inputs['length'])
1✔
66
        self.assertEqual("BBox", new_inputs["bbox"])
1✔
67
        self.assertEqual("Vector", new_inputs["vector"])
1✔
68

69
    def test_get_translations(self):
1✔
70
        title_fr = get_translation(self.process, "title", "fr-CA")
1✔
71
        assert title_fr == "Processus"
1✔
72
        abstract_fr = get_translation(self.process, "abstract", "fr-CA")
1✔
73
        assert abstract_fr == "Une description"
1✔
74
        identifier = get_translation(self.process, "identifier", "fr-CA")
1✔
75
        assert identifier == self.process.identifier
1✔
76

77
def load_tests(loader=None, tests=None, pattern=None):
1✔
78
    """Load local tests
79
    """
80
    import unittest
×
81

82
    if not loader:
×
83
        loader = unittest.TestLoader()
×
84
    suite_list = [
×
85
        loader.loadTestsFromTestCase(ProcessTestCase)
86
    ]
87
    return unittest.TestSuite(suite_list)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc