Skip to content

Commit 25dc882

Browse files
authored
Merge pull request #5 from Accruent/begin_unit_testing
Begin unit testing
2 parents 6eed8e0 + e34d8b4 commit 25dc882

5 files changed

Lines changed: 35 additions & 13 deletions

File tree

dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
FROM python:3.6
22

3+
# Copy the current directory contents into the container at /app
4+
COPY . /app
5+
6+
# Set the working directory to /automation-framework-mock-api
7+
WORKDIR /app
8+
39
# Install any needed packages
410
RUN apt-get update \
5-
&& rm -rf /var/lib/apt/lists/*
6-
RUN pip install git+https://github.com/accruent/owasp-zap-historic
11+
&& rm -rf /var/lib/apt/lists/* \
12+
&& pip install .
713

814
# Make port 5000 available to the world outside this container
915
EXPOSE 5000
1016

17+
# Unit tests
18+
RUN pytest --cov owasp_zap_historic --cov-report term-missing --cov-config=test/.coveragerc -v test/function_test.py
19+
1120
# Run the owasp-zap-historic flask with argument to connect to db
12-
# Below command is to run on local
13-
# docker run -it -p 5000:5000 proget.accruentsystems.com/qe_docker/library/owaspzaphistoric owaspzaphistoric -s "localhost" -t 3306 -u "root" -p "password" -a "0.0.0.0"
21+
# Below command is to run in docker container pointed to local mysql
22+
# CMD owaspzaphistoric -s '192.168.86.248'
23+
# Then in CMD window docker run -p 5000:5000 owaspzaphistoric
24+
# Below command is to run on Rancher and connect to mysql db shared with RFH
1425
CMD owaspzaphistoric -s "${SQLHOST}" -t "${PORT}" -u "${USERNAME}" -p "${PASSWORD}" -a "${FLASKHOST}"

requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
bcrypt~=3.1.7
22
pytz~=2020.1
33
Flask~=1.1.2
4-
setuptools~=41.2.0
4+
setuptools~=41.2.0
5+
pytest-cov
6+
flask_mysqldb
7+
config

setup.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
"""Setup file for owaspzaphistoric."""
22
from setuptools import find_packages, setup
3+
import version
34

45

56
with open("README.md", "r") as fh:
67
LONG_DESCRIPTION = fh.read()
78
print(LONG_DESCRIPTION)
89

10+
with open('requirements.txt') as f:
11+
REQUIREMENTS = f.read().splitlines()
912

1013
setup(
1114
name='owasp-zap-historic',
12-
version="0.1.1",
15+
version=version.VERSION,
1316
description='Custom report to display owasp zap historical execution records',
1417
long_description=LONG_DESCRIPTION,
1518
long_description_content_type='text/markdown',
@@ -28,13 +31,7 @@
2831
include_package_data=True,
2932
zip_safe=False,
3033

31-
install_requires=[
32-
'config',
33-
'flask',
34-
'bcrypt',
35-
'flask-mysqldb',
36-
'pytz'
37-
],
34+
install_requires=REQUIREMENTS,
3835
entry_points={
3936
'console_scripts': [
4037
'owaspzaphistoric=owasp_zap_historic.app:main',

test/.coveragerc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[run]
2+
3+
[paths]
4+
source = owasp_zap_historic/
5+
6+
[report]
7+
exclude_lines =
8+
if __name__ == .__main__.:
9+
model.password =

version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"""Pypi version goes here. Update with releases."""
2+
VERSION = "0.1.1"

0 commit comments

Comments
 (0)