-
Notifications
You must be signed in to change notification settings - Fork 1
/
tests.py
40 lines (35 loc) · 1.13 KB
/
tests.py
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
import unittest
from unittest import TestCase
from unittest.mock import patch
from main import main
class PluginTest(TestCase):
@patch("main.subprocess")
@patch("main.drone")
def test_main_works_with_correct_data(self, mock_drone, mock_subprocess):
mock_subprocess.check_call.return_value = None
mock_drone.plugin.get_input.return_value = {
"repo": {
"name": "repo-name",
},
"workspace": {
"path": "/tmp"
},
"build": {
"number": 10,
"branch": "master",
},
"vargs": {
"url": "$$RANCHER_URL",
"access_key": "$$RANCHER_ACCESS_KEY",
"secret_key": "$$RANCHER_SECRET_KEY",
"compose_file": ".config/dev/docker-compose.yml",
"rancher_file": ".config/dev/rancher-compose.yml",
"services": "web db",
# "force": "true",
"confirm": "true",
"always_pull": "true",
}
}
main()
if __name__ == '__main__':
unittest.main()