Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sams-classes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
coding-at-fu
sams-classes
Merge requests
!5
Resolve "test des SMSHub mit Apps die Proxies haben"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "test des SMSHub mit Apps die Proxies haben"
8-test-samshub-with-proxy
into
master
Overview
1
Commits
2
Pipelines
0
Changes
1
Merged
slobinger
requested to merge
8-test-samshub-with-proxy
into
master
8 years ago
Overview
1
Commits
2
Pipelines
0
Changes
1
Expand
Closes
#8 (closed)
0
0
Merge request reports
Viewing commit
f5b6b6bf
Prev
Next
Show latest version
1 file
+
34
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
f5b6b6bf
add test_hub_provides_apps_with_proxies to test_sams_hub.py see
#8
· f5b6b6bf
Sebastian Lobinger
authored
8 years ago
test/test_sams_hub.py
+
34
−
2
Options
import
unittest
import
unittest
,
requests
from
sams_classes
import
SAMSHub
,
SAMSApp
from
sams_classes.exceptions
import
AppNotExist
from
flask
import
Flask
,
Blueprint
import
sys
import
sys
,
time
from
.helper_classes
import
FlaskInThread
def
eprint
(
*
args
,
**
kwargs
):
print
(
*
args
,
file
=
sys
.
stderr
,
**
kwargs
)
class
CaseSAMSHubWithThreadedAPI
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
hub
=
SAMSHub
(
name
=
'
test
'
,
config
=
{
'
default_language
'
:
'
de
'
,
'
main_app
'
:
'
test
'
})
from
.api_test_server
import
app
as
apiApp
apiApp
.
config
[
'
TESTING
'
]
=
True
thApi
=
FlaskInThread
(
apiApp
,
host
=
"
localhost
"
,
port
=
4711
)
thApi
.
start
()
time
.
sleep
(
0.01
)
def
tearDown
(
self
):
response
=
requests
.
get
(
'
http://localhost:4711/shutdown
'
)
print
(
response
.
content
.
decode
(
'
utf-8
'
))
time
.
sleep
(
0.01
)
def
test_hub_provides_apps_with_proxies
(
self
):
manifest
=
{
'
default_language
'
:
'
de
'
,
'
proxies
'
:
[{
'
in
'
:
'
api
'
,
'
out
'
:
'
http://localhost:4711
'
}]
}
self
.
hub
.
addApp
(
SAMSApp
(
name
=
'
test
'
,
manifest
=
manifest
,
langDict
=
{
'
de
'
:{}})
)
self
.
hub
.
addApp
(
SAMSApp
(
name
=
'
test.app
'
,
manifest
=
manifest
,
langDict
=
{
'
de
'
:{}})
)
with
self
.
hub
.
flaskApp
.
test_client
()
as
client
:
self
.
assertIs
(
client
.
get
(
path
=
'
/api/hello
'
).
status_code
,
200
)
self
.
assertIs
(
client
.
get
(
path
=
'
/test.app/api/hello
'
).
status_code
,
200
)
class
CaseSAMSHubWithMainApp
(
unittest
.
TestCase
):
def
setUp
(
self
):
Loading