1
0
Fork 0

Fixing errors / reformating code

This commit is contained in:
Joao Gilberto Magalhaes 2023-07-01 17:55:25 -05:00
parent 078cb31eb7
commit 3b2e9a43fd
11 changed files with 368 additions and 316 deletions

View file

@ -1,8 +1,8 @@
import pytest
import os
from functions import Functions
from processor import ProcessorInterface
from processor import Static
def test_processor_static():
ProcessorInterface.static_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "./fixtures/static.yml")
@ -10,44 +10,44 @@ def test_processor_static():
parsed_object = [
{
"hosts":{
"host1.com.br":{
"containers":[
"container:5000"
"hosts": {
"host1.com.br": {
"containers": [
"container:5000"
],
"certbot": True
},
"host2.com.br":{
"containers":[
"other:3000"
"host2.com.br": {
"containers": [
"other:3000"
]
}
},
"port":80,
"redirect":{
"www.host1.com.br":"http://host1.com.br"
"port": 80,
"redirect": {
"www.host1.com.br": "http://host1.com.br"
}
},
{
"hosts":{
"host1.com.br":{
"containers":[
"container:80"
"hosts": {
"host1.com.br": {
"containers": [
"container:80"
]
}
},
"port":443,
"port": 443,
"ssl": True
},
{
"hosts":{
"host3.com.br":{
"containers":[
"domain:8181"
"hosts": {
"host3.com.br": {
"containers": [
"domain:8181"
]
}
},
"port":8080
"port": 8080
}
]
hosts = [
@ -63,11 +63,12 @@ def test_processor_static():
haproxy_cfg = static.get_haproxy_conf()
assert haproxy_cfg == Functions.load(os.path.join(os.path.dirname(os.path.realpath(__file__)), "./expected/static.txt"))
assert haproxy_cfg == Functions.load(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "./expected/static.txt"))
# @todo: Static doesnt populate this fields
assert static.get_certbot_hosts() == []
assert static.get_parsed_object() == parsed_object
assert static.get_hosts() == hosts
# test_processor_static()
# test_processor_static()