File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 6
6
test :
7
7
runs-on : ubuntu-latest
8
8
9
- env :
10
- ES_SERVER : ${{ secrets.ES_SERVER }}
11
-
12
9
steps :
13
10
- name : Checkout code
14
11
uses : actions/checkout@v2
Original file line number Diff line number Diff line change 5
5
#pylint: disable = missing-function-docstring
6
6
#pylint: disable = import-error
7
7
import os
8
+ from unittest .mock import patch
8
9
9
10
from elasticsearch .exceptions import NotFoundError
10
11
import pytest
14
15
from fmatch .matcher import Matcher
15
16
16
17
18
+
17
19
@pytest .fixture
18
20
def matcher_instance ():
19
21
sample_output = {
@@ -24,10 +26,11 @@ def matcher_instance():
24
26
]
25
27
}
26
28
}
27
- match = Matcher (index = "perf-scale-ci" )
28
- match .es .search = lambda * args , ** kwargs : sample_output
29
- return match
30
-
29
+ with patch ('fmatch.matcher.Elasticsearch' ) as mock_es :
30
+ mock_es_instance = mock_es .return_value
31
+ mock_es_instance .search .return_value = sample_output
32
+ match = Matcher (index = "perf-scale-ci" )
33
+ return match
31
34
32
35
def test_get_metadata_by_uuid_found (matcher_instance ):
33
36
uuid = "test_uuid"
You can’t perform that action at this time.
0 commit comments