File tree 5 files changed +20
-48
lines changed
5 files changed +20
-48
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,6 @@ USER root
5
5
6
6
WORKDIR "/"
7
7
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
-
15
8
# load in the Pip requirements.txt file (assumes context is parent folder...)
16
9
ADD ./requirements.txt /
17
10
Original file line number Diff line number Diff line change 1
1
# pytesting - Docker
2
- 4oh4 - Dec 2019
3
2
4
3
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.
5
4
6
5
## Usage
7
6
8
7
From the ` pytesting/Docker ` folder, use the following commads at the command line:
9
8
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
Original file line number Diff line number Diff line change @@ -15,11 +15,5 @@ services:
15
15
command :
16
16
/bin/bash
17
17
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
-
24
18
volumes :
25
19
- ../:/working
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 12
12
13
13
"""
14
14
15
+ import os
16
+
15
17
from truth .truth import AssertThat
16
18
17
19
# Module under test
@@ -39,18 +41,28 @@ def test_init(mocker):
39
41
40
42
def test_loadData (mocker ):
41
43
"""
42
- Test parseLine with good data (all fields present)
44
+ Test application loading data from text file
43
45
44
- Expected result: dict returne with data
46
+ Expected result: app loads data into DB via DAO
45
47
"""
46
48
47
49
# given: setup test framework
48
50
mock_dao = mocker .patch ('src.main.DAO' )
49
51
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
51
58
app = Application ()
52
59
53
- # when:
60
+ # when:
61
+ app .loadData (dummy_data_filepath )
54
62
55
63
# 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' ],)
You can’t perform that action at this time.
0 commit comments