test.test_url_join   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 36
dl 0
loc 46
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A TestURLJoin.test_bare_host_and_path_without_slash() 0 4 1
A TestURLJoin.test_host_with_path_no_slash_and_path_with_slash() 0 4 1
A TestURLJoin.test_bare_host_and_path_with_slash() 0 4 1
A TestURLJoin.test_host_with_slash_and_path_without_slash() 0 4 1
A TestURLJoin.test_host_with_slash_and_path_with_slash() 0 4 1
A TestURLJoin.test_host_with_path_no_slash_and_path_without_slash() 0 4 1
A TestURLJoin.test_host_with_path_and_slash_and_path_without_slash() 0 4 1
A TestURLJoin.test_host_with_path_and_slash_and_path_with_slash() 0 4 1
1
from unittest import TestCase
2
3
from kibana_prometheus_exporter.helpers import url_join
4
5
6
class TestURLJoin(TestCase):
7
    def test_bare_host_and_path_with_slash(self):
8
        host = "http://example.com"
9
        path = "/some/path"
10
        self.assertEqual(url_join(host, path), "http://example.com/some/path")
11
12
    def test_bare_host_and_path_without_slash(self):
13
        host = "http://example.com"
14
        path = "some/path"
15
        self.assertEqual(url_join(host, path), "http://example.com/some/path")
16
17
    def test_host_with_slash_and_path_with_slash(self):
18
        host = "http://example.com/"
19
        path = "/some/path"
20
        self.assertEqual(url_join(host, path), "http://example.com/some/path")
21
22
    def test_host_with_slash_and_path_without_slash(self):
23
        host = "http://example.com/"
24
        path = "some/path"
25
        self.assertEqual(url_join(host, path), "http://example.com/some/path")
26
27
    def test_host_with_path_no_slash_and_path_with_slash(self):
28
        host = "http://example.com/test"
29
        path = "/some/path"
30
        self.assertEqual(url_join(host, path), "http://example.com/test/some/path")
31
32
    def test_host_with_path_no_slash_and_path_without_slash(self):
33
        host = "http://example.com/test"
34
        path = "some/path"
35
        self.assertEqual(url_join(host, path), "http://example.com/test/some/path")
36
37
    def test_host_with_path_and_slash_and_path_without_slash(self):
38
        host = "http://example.com/test/"
39
        path = "some/path"
40
        self.assertEqual(url_join(host, path), "http://example.com/test/some/path")
41
42
    def test_host_with_path_and_slash_and_path_with_slash(self):
43
        host = "http://example.com/test/"
44
        path = "/some/path"
45
        self.assertEqual(url_join(host, path), "http://example.com/test/some/path")
46