Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Setra Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
it-bott-integrasjoner
Setra Client
Commits
ce2a1dc5
Commit
ce2a1dc5
authored
4 years ago
by
Petr Kalashnikov
Browse files
Options
Downloads
Patches
Plain Diff
FSHO10: support filtering of batches in list from setra
parent
5162e916
No related branches found
No related tags found
2 merge requests
!13
Fsho12, del 1: mulighet å returnere en liste av batcher uten vouchere
,
!11
FSHO10: support filtering of batches in list from setra
Pipeline
#64640
passed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
setra_client/client.py
+13
-2
13 additions, 2 deletions
setra_client/client.py
tests/test_client.py
+9
-0
9 additions, 0 deletions
tests/test_client.py
with
22 additions
and
2 deletions
setra_client/client.py
+
13
−
2
View file @
ce2a1dc5
...
@@ -181,16 +181,27 @@ class SetraClient(object):
...
@@ -181,16 +181,27 @@ class SetraClient(object):
return
data
return
data
return
cls
.
from_dict
(
data
)
return
cls
.
from_dict
(
data
)
def
get_batch
(
self
,
batch_id
:
int
=
None
):
def
get_batch
(
self
,
batch_id
:
int
=
None
,
min_created_date
:
str
=
None
,
max_created_date
:
str
=
None
,
batch_progress
:
str
=
None
,
interface
:
str
=
None
):
"""
"""
GETs one or all batches from SETRA
GETs one or all batches from SETRA
"""
"""
params
=
None
if
batch_id
is
not
None
:
if
batch_id
is
not
None
:
batch_id
=
str
(
batch_id
)
batch_id
=
str
(
batch_id
)
else
:
params
=
{
'
min_created_date
'
:
min_created_date
,
'
max_created_date
'
:
max_created_date
,
'
batch_progress
'
:
batch_progress
,
'
interface
'
:
interface
}
url
=
self
.
urls
.
batch
(
batch_id
)
url
=
self
.
urls
.
batch
(
batch_id
)
response
=
self
.
get
(
url
)
response
=
self
.
get
(
url
,
params
=
params
)
return
response
.
json
()
return
response
.
json
()
def
get_voucher
(
self
,
vouch_id
:
int
=
None
):
def
get_voucher
(
self
,
vouch_id
:
int
=
None
):
...
...
This diff is collapsed.
Click to expand it.
tests/test_client.py
+
9
−
0
View file @
ce2a1dc5
...
@@ -190,6 +190,15 @@ def test_successful_get_all_batches(client, requests_mock, baseurl):
...
@@ -190,6 +190,15 @@ def test_successful_get_all_batches(client, requests_mock, baseurl):
assert
response
==
{
'
foo
'
:
'
bar
'
}
assert
response
==
{
'
foo
'
:
'
bar
'
}
def
test_successful_get_batches_foltered_by_status
(
client
,
requests_mock
,
baseurl
):
"""
A working GET call should return HTTP 200, with json content
"""
url
=
SetraEndpoints
(
baseurl
).
batch
()
requests_mock
.
get
(
url
,
json
=
{
'
foo
'
:
'
bar
'
},
status_code
=
200
)
response
=
client
.
get_batch
(
batch_progress
=
"
ubw_import_ok
"
)
assert
response
==
{
'
foo
'
:
'
bar
'
}
def
test_successfully_getting_single_batch
(
client
,
requests_mock
,
baseurl
):
def
test_successfully_getting_single_batch
(
client
,
requests_mock
,
baseurl
):
"""
A working GET call should return HTTP 200, with json content
"""
"""
A working GET call should return HTTP 200, with json content
"""
url
=
SetraEndpoints
(
baseurl
).
batch
(
batch_id
=
'
3
'
)
url
=
SetraEndpoints
(
baseurl
).
batch
(
batch_id
=
'
3
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment