Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aura-engine
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Kruse
aura-engine
Commits
3e950274
Commit
3e950274
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Some basic test case. #63
parent
a19f0338
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test.py
+22
-100
22 additions, 100 deletions
tests/test.py
with
22 additions
and
100 deletions
tests/test.py
+
22
−
100
View file @
3e950274
...
...
@@ -26,11 +26,9 @@ from datetime import datetime
from
src.base.logger
import
AuraLogger
from
src.base.config
import
AuraConfig
from
src.scheduling.models
import
Timeslot
# src
from
src.scheduling.scheduler
import
AuraScheduler
class
TestLogger
(
unittest
.
TestCase
):
aura_logger
=
None
...
...
@@ -44,117 +42,41 @@ class TestLogger(unittest.TestCase):
class
TestConfig
(
unittest
.
TestCase
):
aura_config
=
None
config
=
None
def
setUp
(
self
):
self
.
aura_config
=
AuraConfig
()
self
.
config
=
AuraConfig
()
def
test_config
(
self
):
#
is ini path correct set?
self
.
assert
Equal
(
self
.
config
.
ini_path
,
"
/etc/aura/engine.ini
"
)
#
Check if config is available
self
.
assert
IsNotNone
(
self
.
config
.
ini_path
)
# install_dir is
set by runtime. is it a directory?
#
Check if "
install_dir
"
is
a valid directory (is evaluated at runtime)
self
.
assertTrue
(
os
.
path
.
isdir
(
self
.
config
.
get
(
"
install_dir
"
)))
# calendarurl and importerurl set and valid urls?
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
calendarurl
"
)))
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
importerurl
"
)))
# is liquidsoap socketdir set and a directory?
# Check API Urls
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
api_steering_status
"
)))
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
api_steering_calendar
"
)))
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
api_tank_status
"
)))
tank_playlist_url
=
self
.
config
.
get
(
"
api_tank_playlist
"
).
replace
(
"
${ID}
"
,
"
1
"
)
self
.
assertTrue
(
validators
.
url
(
tank_playlist_url
))
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
api_engine_status
"
)))
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
api_engine_store_playlog
"
)))
self
.
assertTrue
(
validators
.
url
(
self
.
config
.
get
(
"
api_engine_store_clock
"
)))
engine_health_url
=
self
.
config
.
get
(
"
api_engine_store_health
"
).
replace
(
"
${ENGINE_NUMBER}
"
,
"
1
"
)
self
.
assertTrue
(
validators
.
url
(
engine_health_url
))
# Check if Liquidsoap "socketdir" is set and a directory
self
.
assertTrue
(
os
.
path
.
isdir
(
self
.
config
.
get
(
"
socketdir
"
)))
# database settings set
?
#
Check if
database settings
are
set
self
.
assertIsNotNone
(
self
.
config
.
get
(
"
db_user
"
))
self
.
assertIsNotNone
(
self
.
config
.
get
(
"
db_pass
"
))
self
.
assertIsNotNone
(
self
.
config
.
get
(
"
db_name
"
))
self
.
assertIsNotNone
(
self
.
config
.
get
(
"
db_host
"
))
class
TestTimeslot
(
unittest
.
TestCase
):
timeslot
=
None
def
setUp
(
self
):
self
.
timeslot
=
Timeslot
()
def
test_timeslot
(
self
):
# select one and check if its not None and a Timeslot
entry
=
self
.
timeslot
.
select_by_id
(
1
)
self
.
assertIsNotNone
(
entry
)
self
.
assertIsInstance
(
entry
,
Timeslot
)
class
TestTimeslotEntry
(
unittest
.
TestCase
):
timeslot_entry
=
None
def
setUp
(
self
):
self
.
timeslot_entry
=
TimeslotEntry
()
def
test_timeslot_entry
(
self
):
# select one playlist and check if its not None, a TimeslotEntry
entry
=
self
.
timeslot_entry
.
select_playlist
(
2
)
self
.
assertIsNotNone
(
entry
)
self
.
assertIsInstance
(
entry
,
list
)
self
.
assertGreaterEqual
(
len
(
entry
),
1
)
class
TestTrackService
(
unittest
.
TestCase
):
track_service
=
None
def
setUp
(
self
):
self
.
track_service
=
TrackService
()
def
test_track_service
(
self
):
day
=
datetime
.
strptime
(
"
19.03.2018
"
,
"
%d.%m.%Y
"
)
entry
=
self
.
track_service
.
select_by_day
(
day
)
self
.
assertIsNotNone
(
entry
)
self
.
assertIsInstance
(
entry
,
list
)
class
TestAuraUser
(
unittest
.
TestCase
):
aura_user
=
None
def
setUp
(
self
):
self
.
aura_user
=
AuraUser
()
def
test_add_user
(
self
):
username
=
"
user
"
password
=
"
password
"
role
=
"
admin
"
login_cnt
=
len
(
self
.
aura_user
.
getLogins
())
# insert user
key
=
self
.
aura_user
.
insertUser
(
username
,
password
,
role
)
self
.
assertGreaterEqual
(
len
(
self
.
aura_user
.
getLogins
()),
login_cnt
)
# selecting user and check data
user
=
self
.
aura_user
.
getUserByKey
(
key
)
self
.
assertEqual
(
user
[
"
username
"
],
username
)
# TODO: no encrypted storage.., but usermgm not really in use
self
.
assertEqual
(
user
[
"
password
"
],
password
)
self
.
assertEqual
(
user
[
"
role
"
],
role
)
class
TestLQSComm
(
unittest
.
TestCase
):
comm
=
None
def
setUp
(
self
):
# wosn do passiert?
p
=
AuraConfig
().
config
self
.
soundsystem
=
SoundSystem
(
p
)
self
.
soundsystem
.
scheduler
=
AuraScheduler
(
p
)
self
.
soundsystem
.
init_player
()
def
test_get_active_channel
(
self
):
active_channel
=
self
.
comm
.
get_active_channel
()
print
(
active_channel
)
if
__name__
==
'
__main__
'
:
...
...
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