Skip to content

Commit 03f1db8

Browse files
aliceinwireAlice Ferrazzi
authored andcommitted
Init pytest
1 parent bdf42c7 commit 03f1db8

7 files changed

Lines changed: 47 additions & 5 deletions

File tree

elivepatch_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
__version__ = '0.1'
88
__author__ = 'Alice Ferrazzi'
9-
__license__ = 'GNU GPLv2+'
9+
__license__ = 'GNU GPLv2+'

init/elivepatch.init

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ depend() {
44
need net
55
}
66

7-
DAEMON=/usr/bin/elivepatch-server
8-
DAEMON_NAME=elivepatch-server
7+
DAEMON=/usr/bin/elivepatch_server
8+
DAEMON_NAME=elivepatch_server
99
PIDFILE=/var/run/${DAEMON_NAME}.pid
1010

1111
start_pre() {

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
flask
2-
flask_restful
2+
flask_restful
3+
flask_testing
4+
pytest

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
author_email='alice.ferrazzi@gmail.com',
2929
license='GNU GPLv2+',
3030
packages=['elivepatch_server','elivepatch_server.resources'],
31-
scripts=['elivepatch_server/elivepatch-server'],
31+
scripts=['elivepatch_server/elivepatch_server'],
3232
)

tests/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
import os.path
3+
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
4+
5+
from elivepatch_server.elivepatch_server import create_app
6+
import pytest
7+
from flask_restful import Api as api
8+
from flask_testing import TestCase
9+
10+
@pytest.fixture
11+
def app():
12+
app = create_app('testing')
13+
return app

tests/test_app.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from elivepatch_server.elivepatch_server import create_app
2+
import pytest
3+
from flask_restful import Api as api
4+
from conftest import app
5+
import unittest
6+
7+
8+
class TestIntegrations(unittest.TestCase):
9+
10+
def cmdline_args(object):
11+
debug=True
12+
host="0.0.0.0"
13+
port="5000"
14+
threaded=True
15+
16+
def setUp(self):
17+
cmdline=self.cmdline_args()
18+
self.app = create_app(cmdline)
19+
self.app = self.app.test_client()
20+
21+
def test_not_found(self):
22+
response = self.app.get('/')
23+
assert response.status_code == 404
24+
25+
def test_found(self):
26+
response = self.app.get('/elivepatch/api/')
27+
assert response.status_code == 200

0 commit comments

Comments
 (0)