Skip to content

Commit 29f204b

Browse files
committed
Tidy up Docker
1 parent 2b5c3c0 commit 29f204b

File tree

5 files changed

+20
-48
lines changed

5 files changed

+20
-48
lines changed

Docker/Dockerfile

-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ USER root
55

66
WORKDIR "/"
77

8-
# load in the Conda environment.yml file
9-
# ADD ./environment.yml /
10-
11-
# update the environnment
12-
# RUN conda env update -f environment.yml
13-
14-
158
# load in the Pip requirements.txt file (assumes context is parent folder...)
169
ADD ./requirements.txt /
1710

Docker/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# pytesting - Docker
2-
4oh4 - Dec 2019
32

43
Use this Docker configuration to quickly run the demo code. It creates a Python environment with the required dependencies in a Docker container, with shell access.
54

65
## Usage
76

87
From the `pytesting/Docker` folder, use the following commads at the command line:
98

10-
`docker-compose -d up`
11-
`docker-compose run inertial_nav`
12-
`python run_tests.py`
9+
docker-compose -d up
10+
docker-compose run pytesting
11+
python run_tests.py

Docker/docker-compose.yml

-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,5 @@ services:
1515
command:
1616
/bin/bash
1717

18-
# ports:
19-
# - "8888:8888"
20-
21-
#command:
22-
# jupyter lab --no-browser --ip=0.0.0.0 --allow-root --NotebookApp.token='local_dev'
23-
2418
volumes:
2519
- ../:/working

Docker/environment.yml

-26
This file was deleted.

tests/test_main.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
1313
"""
1414

15+
import os
16+
1517
from truth.truth import AssertThat
1618

1719
# Module under test
@@ -39,18 +41,28 @@ def test_init(mocker):
3941

4042
def test_loadData(mocker):
4143
"""
42-
Test parseLine with good data (all fields present)
44+
Test application loading data from text file
4345
44-
Expected result: dict returne with data
46+
Expected result: app loads data into DB via DAO
4547
"""
4648

4749
# given: setup test framework
4850
mock_dao = mocker.patch('src.main.DAO')
4951
mock_worker = mocker.patch('src.main.Worker')
50-
mock_worker.readData.return_value = None
52+
dummy_data_filepath = 'data/dummy_datafile.txt'
53+
mock_data = {'job_title': 'Mechanic',
54+
'company_name': 'Red123',
55+
'salary': 98765,
56+
'date': '14/06/2019'}
57+
mock_worker.readData.return_value = mock_data
5158
app = Application()
5259

53-
# when:
60+
# when:
61+
app.loadData(dummy_data_filepath)
5462

5563
# then:
56-
AssertThat(mock_worker.readData).WasCalled().Once()
64+
AssertThat(mock_worker.readData).WasCalled().Once().With(dummy_data_filepath)
65+
AssertThat(mock_dao.insert_job).WasCalled().Once().With(mock_data['job_title'],
66+
mock_data['company_name'],
67+
mock_data['salary'],
68+
mock_data['date'],)

0 commit comments

Comments
 (0)