Example #1
0
    def test_extract_push_target_http(self):
        http_scheme = 'http'
        host = 'beta.askanna.eu'
        workspace_suuid = '6swz-ujcr-jQQw-SAdZ'
        project_suuid = '6mxc-03Ew-THeb-ftGG'

        push_target = f'{http_scheme}://{host}/{workspace_suuid}/project/{project_suuid}'
        push_target_2 = f'{http_scheme}://{host}/{workspace_suuid}/project/{project_suuid}/'

        expected_result = PushTarget(
            url=push_target,
            http_scheme=http_scheme,
            host=host,
            workspace_suuid=workspace_suuid,
            project_suuid=project_suuid,
        )
        expected_result_2 = PushTarget(
            url=push_target_2,
            http_scheme=http_scheme,
            host=host,
            workspace_suuid=workspace_suuid,
            project_suuid=project_suuid,
        )

        result = extract_push_target(push_target)
        result_2 = extract_push_target(push_target_2)

        self.assertEqual(result, expected_result)
        self.assertEqual(result_2, expected_result_2)
Example #2
0
    def test_extract_push_target_no_workspace(self):
        http_scheme = 'https'
        host = 'beta-api.askanna.eu'
        project_suuid = '6mxc-03Ew-THeb-ftGG'

        push_target = f'{http_scheme}://{host}/project/{project_suuid}'
        push_target_2 = f'{http_scheme}://{host}/project/{project_suuid}/'

        expected_result = PushTarget(
            url=push_target,
            http_scheme=http_scheme,
            host=host,
            workspace_suuid=None,
            project_suuid=project_suuid,
        )
        expected_result_2 = PushTarget(
            url=push_target_2,
            http_scheme=http_scheme,
            host=host,
            workspace_suuid=None,
            project_suuid=project_suuid,
        )

        result = extract_push_target(push_target)
        result_2 = extract_push_target(push_target_2)

        self.assertEqual(result, expected_result)
        self.assertEqual(result_2, expected_result_2)
Example #3
0
 def test_extract_not_valid_push_target(self):
     with pytest.raises(ValueError):
         extract_push_target('https://example.com/')
Example #4
0
 def test_extract_push_target_not_set(self):
     with pytest.raises(ValueError):
         extract_push_target('')