File: conftest.py

package info (click to toggle)
hcloud-python 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,396 kB
  • sloc: python: 15,311; makefile: 43; javascript: 3
file content (144 lines) | stat: -rw-r--r-- 4,463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
from __future__ import annotations

import pytest


@pytest.fixture()
def image_response():
    return {
        "image": {
            "id": 4711,
            "type": "snapshot",
            "status": "available",
            "name": "ubuntu-20.04",
            "description": "Ubuntu 20.04 Standard 64 bit",
            "image_size": 2.3,
            "disk_size": 10,
            "created": "2016-01-30T23:50+00:00",
            "created_from": {"id": 1, "name": "Server"},
            "bound_to": 1,
            "os_flavor": "ubuntu",
            "os_version": "16.04",
            "architecture": "x86",
            "rapid_deploy": False,
            "protection": {"delete": False},
            "deprecated": "2018-02-28T00:00:00+00:00",
            "labels": {},
        }
    }


@pytest.fixture()
def two_images_response():
    return {
        "images": [
            {
                "id": 4711,
                "type": "snapshot",
                "status": "available",
                "name": "ubuntu-20.04",
                "description": "Ubuntu 20.04 Standard 64 bit",
                "image_size": 2.3,
                "disk_size": 10,
                "created": "2016-01-30T23:50+00:00",
                "created_from": {"id": 1, "name": "Server"},
                "bound_to": None,
                "os_flavor": "ubuntu",
                "os_version": "16.04",
                "architecture": "x86",
                "rapid_deploy": False,
                "protection": {"delete": False},
                "deprecated": "2018-02-28T00:00:00+00:00",
                "labels": {},
            },
            {
                "id": 4712,
                "type": "system",
                "status": "available",
                "name": "ubuntu-18.10",
                "description": "Ubuntu 18.10 Standard 64 bit",
                "image_size": 2.3,
                "disk_size": 10,
                "created": "2016-01-30T23:50+00:00",
                "created_from": {"id": 1, "name": "Server"},
                "bound_to": None,
                "os_flavor": "ubuntu",
                "os_version": "16.04",
                "architecture": "x86",
                "rapid_deploy": False,
                "protection": {"delete": False},
                "deprecated": "2018-02-28T00:00:00+00:00",
                "labels": {},
            },
        ]
    }


@pytest.fixture()
def one_images_response():
    return {
        "images": [
            {
                "id": 4711,
                "type": "snapshot",
                "status": "available",
                "name": "ubuntu-20.04",
                "description": "Ubuntu 20.04 Standard 64 bit",
                "image_size": 2.3,
                "disk_size": 10,
                "created": "2016-01-30T23:50+00:00",
                "created_from": {"id": 1, "name": "Server"},
                "bound_to": None,
                "os_flavor": "ubuntu",
                "os_version": "16.04",
                "architecture": "x86",
                "rapid_deploy": False,
                "protection": {"delete": False},
                "deprecated": "2018-02-28T00:00:00+00:00",
                "labels": {},
            }
        ]
    }


@pytest.fixture()
def response_update_image():
    return {
        "image": {
            "id": 4711,
            "type": "snapshot",
            "status": "available",
            "name": None,
            "description": "My new Image description",
            "image_size": 2.3,
            "disk_size": 10,
            "created": "2016-01-30T23:50+00:00",
            "created_from": {"id": 1, "name": "Server"},
            "bound_to": None,
            "os_flavor": "ubuntu",
            "os_version": "16.04",
            "architecture": "arm",
            "rapid_deploy": False,
            "protection": {"delete": False},
            "deprecated": "2018-02-28T00:00:00+00:00",
            "labels": {},
        }
    }


@pytest.fixture()
def response_get_actions():
    return {
        "actions": [
            {
                "id": 13,
                "command": "change_protection",
                "status": "success",
                "progress": 100,
                "started": "2016-01-30T23:55:00+00:00",
                "finished": "2016-01-30T23:56:00+00:00",
                "resources": [{"id": 42, "type": "image"}],
                "error": {"code": "action_failed", "message": "Action failed"},
            }
        ]
    }