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
Commits
f5b6b6bf
Commit
f5b6b6bf
authored
8 years ago
by
Sebastian Lobinger
Browse files
Options
Downloads
Patches
Plain Diff
add test_hub_provides_apps_with_proxies to test_sams_hub.py see
#8
parent
47bd8f54
No related branches found
No related tags found
1 merge request
!5
Resolve "test des SMSHub mit Apps die Proxies haben"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_sams_hub.py
+34
-2
34 additions, 2 deletions
test/test_sams_hub.py
with
34 additions
and
2 deletions
test/test_sams_hub.py
+
34
−
2
View file @
f5b6b6bf
import
unittest
import
unittest
,
requests
from
sams_classes
import
SAMSHub
,
SAMSApp
from
sams_classes
import
SAMSHub
,
SAMSApp
from
sams_classes.exceptions
import
AppNotExist
from
sams_classes.exceptions
import
AppNotExist
from
flask
import
Flask
,
Blueprint
from
flask
import
Flask
,
Blueprint
import
sys
import
sys
,
time
from
.helper_classes
import
FlaskInThread
def
eprint
(
*
args
,
**
kwargs
):
def
eprint
(
*
args
,
**
kwargs
):
print
(
*
args
,
file
=
sys
.
stderr
,
**
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
):
class
CaseSAMSHubWithMainApp
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
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