diff --git a/src/rest/controllers/internal_controller.py b/src/rest/controllers/internal_controller.py index 7dcd6954ca59e3d8620db16c7256cd90da143319..8802e363bf5b96d39b144d182e761bd70ac7af0b 100644 --- a/src/rest/controllers/internal_controller.py +++ b/src/rest/controllers/internal_controller.py @@ -2,27 +2,11 @@ import connexion import six from src.rest.models.clock_info import ClockInfo # noqa: E501 -from src.rest.models.health_info import HealthInfo # noqa: E501 +from src.rest.models.health_log import HealthLog # noqa: E501 from src.rest.models.inline_response400 import InlineResponse400 # noqa: E501 -from src.rest.models.play_log_entry import PlayLogEntry # noqa: E501 -from src.rest.models.status_entry import StatusEntry # noqa: E501 +from src.rest.models.play_log import PlayLog # noqa: E501 from src.rest import util -from flask import current_app -from dateutil.parser import parse - -def activate_engine(engine_number): # noqa: E501 - """Set active engine - - Activates one engine and deactivates the other # noqa: E501 - - :param engine_number: Number of the engine - :type engine_number: int - - :rtype: None - """ - return 'do some magic!' - def add_playlog(body): # noqa: E501 """Adds an entry to the playlog @@ -35,7 +19,7 @@ def add_playlog(body): # noqa: E501 :rtype: None """ if connexion.request.is_json: - body = PlayLogEntry.from_dict(connexion.request.get_json()) # noqa: E501 + body = PlayLog.from_dict(connexion.request.get_json()) # noqa: E501 service = current_app.config['SERVICE'] service.store_playlog(body) @@ -51,44 +35,44 @@ def clock_info(): # noqa: E501 return 'do some magic!' -def get_active_engine(): # noqa: E501 - """Get active engine +def get_active_source(): # noqa: E501 + """Get active play-out source (engine1, engine2) - Retrieves the status entry of the currently active engine # noqa: E501 + Retrieves the status entry of the currently active source (engine 1, 2 or other source) # noqa: E501 - :rtype: StatusEntry + :rtype: int """ return 'do some magic!' -def get_engine_health(engine_number): # noqa: E501 - """Get most recent health info +def get_report(year_month): # noqa: E501 + """Report for one month - Retrieves the most recent health info of the requested engine # noqa: E501 + Returns a report for the given month # noqa: E501 - :param engine_number: Number of the engine - :type engine_number: int + :param year_month: Month to create the report for in the format \"yyyy_mm\" + :type year_month: str - :rtype: HealthInfo + :rtype: List[PlayLog] """ return 'do some magic!' -def get_report(year_month): # noqa: E501 - """Report for one month +def get_source_health(number): # noqa: E501 + """Get most recent health info - Returns a report for the given month # noqa: E501 + Retrieves the most recent health info of the requested engine # noqa: E501 - :param year_month: Month to create the report for in the format \"yyyy_mm\" - :type year_month: str + :param number: Number of the engine + :type number: int - :rtype: List[PlayLogEntry] + :rtype: HealthLog """ return 'do some magic!' -def list_playlog(date_time, page=None, limit=None): # noqa: E501 +def list_playlog(date_time, page=None, limit=None, skip_synced=None): # noqa: E501 """List tracks in the play-log since the given timestamp Get paginated playlog entries for since the given timestamp. # noqa: E501 @@ -99,21 +83,36 @@ def list_playlog(date_time, page=None, limit=None): # noqa: E501 :type page: int :param limit: The numbers of items to return per page :type limit: int + :param skip_synced: If true only returns items which are in unsynced state on the main node + :type skip_synced: bool - :rtype: List[PlayLogEntry] + :rtype: List[PlayLog] """ service = current_app.config['SERVICE'] date_time = parse(date_time) return service.list_playlog(page, limit, date_time) -def log_engine_health(engine_number): # noqa: E501 +def log_source_health(number): # noqa: E501 """Log health info Logs another health entry for the given engine # noqa: E501 - :param engine_number: Number of the engine - :type engine_number: int + :param number: Number of the engine + :type number: int + + :rtype: None + """ + return 'do some magic!' + + +def set_active_source(number): # noqa: E501 + """Set active play-out source (engine1, engine2) + + Activates one engine and deactivates the other # noqa: E501 + + :param number: Number of the engine + :type number: int :rtype: None """ diff --git a/src/rest/controllers/public_controller.py b/src/rest/controllers/public_controller.py index de4c94f95ac453a31526d19de368298cd8aef65a..bc833476e3a22ea7a651dbed38443af844eea938 100644 --- a/src/rest/controllers/public_controller.py +++ b/src/rest/controllers/public_controller.py @@ -1,8 +1,7 @@ -import datetime import connexion import six -from src.rest.models.play_log_entry import PlayLogEntry # noqa: E501 +from src.rest.models.play_log import PlayLog # noqa: E501 from src.rest import util from flask import current_app @@ -13,7 +12,7 @@ def current_track(): # noqa: E501 Retrieves the currently playing track. # noqa: E501 - :rtype: PlayLogEntry + :rtype: PlayLog """ service = current_app.config['SERVICE'] return service.current_track() @@ -29,7 +28,7 @@ def list_tracks(page=None, limit=None): # noqa: E501 :param limit: The numbers of items to return per page :type limit: int - :rtype: List[PlayLogEntry] + :rtype: List[PlayLog] """ service = current_app.config['SERVICE'] return service.list_tracks(page, limit) diff --git a/src/rest/models/__init__.py b/src/rest/models/__init__.py index dde7e802354b1214938da8212a1694aa2b4413b7..00e5db4dcb8e5ddcfddd61b3fa47f844d967c2e3 100644 --- a/src/rest/models/__init__.py +++ b/src/rest/models/__init__.py @@ -4,9 +4,8 @@ from __future__ import absolute_import # import models into model package from src.rest.models.clock_info import ClockInfo -from src.rest.models.health_info import HealthInfo +from src.rest.models.health_log import HealthLog from src.rest.models.inline_response400 import InlineResponse400 -from src.rest.models.play_log_entry import PlayLogEntry -from src.rest.models.playlist_entry import PlaylistEntry -from src.rest.models.status_entry import StatusEntry +from src.rest.models.play_log import PlayLog from src.rest.models.timeslot import Timeslot +from src.rest.models.track import Track diff --git a/src/rest/models/clock_info.py b/src/rest/models/clock_info.py index 5475019f1554a546a852f80a8e07113e9d269249..93a544db4c7ea0685ddc72fca306ec1687ae8ec9 100644 --- a/src/rest/models/clock_info.py +++ b/src/rest/models/clock_info.py @@ -6,7 +6,7 @@ from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from src.rest.models.base_model_ import Model -from src.rest.models.play_log_entry import PlayLogEntry # noqa: F401,E501 +from src.rest.models.play_log import PlayLog # noqa: F401,E501 from src.rest.models.timeslot import Timeslot # noqa: F401,E501 from src.rest import util @@ -20,14 +20,14 @@ class ClockInfo(Model): """ClockInfo - a model defined in Swagger :param current_track: The current_track of this ClockInfo. # noqa: E501 - :type current_track: PlayLogEntry + :type current_track: PlayLog :param current_timeslot: The current_timeslot of this ClockInfo. # noqa: E501 :type current_timeslot: Timeslot :param next_timeslot: The next_timeslot of this ClockInfo. # noqa: E501 :type next_timeslot: Timeslot """ self.swagger_types = { - 'current_track': PlayLogEntry, + 'current_track': PlayLog, 'current_timeslot': Timeslot, 'next_timeslot': Timeslot } @@ -58,7 +58,7 @@ class ClockInfo(Model): :return: The current_track of this ClockInfo. - :rtype: PlayLogEntry + :rtype: PlayLog """ return self._current_track @@ -68,7 +68,7 @@ class ClockInfo(Model): :param current_track: The current_track of this ClockInfo. - :type current_track: PlayLogEntry + :type current_track: PlayLog """ self._current_track = current_track diff --git a/src/rest/models/health_info.py b/src/rest/models/health_log.py similarity index 50% rename from src/rest/models/health_info.py rename to src/rest/models/health_log.py index c184af97128affb847cc1b03f77e5bb612c08098..f6a160994733f51904dcdfb8ef46a803dc967945 100644 --- a/src/rest/models/health_info.py +++ b/src/rest/models/health_log.py @@ -9,29 +9,34 @@ from src.rest.models.base_model_ import Model from src.rest import util -class HealthInfo(Model): +class HealthLog(Model): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self, log_time=None, details=None): # noqa: E501 - """HealthInfo - a model defined in Swagger + def __init__(self, log_time=None, is_healthy=None, details=None): # noqa: E501 + """HealthLog - a model defined in Swagger - :param log_time: The log_time of this HealthInfo. # noqa: E501 + :param log_time: The log_time of this HealthLog. # noqa: E501 :type log_time: datetime - :param details: The details of this HealthInfo. # noqa: E501 + :param is_healthy: The is_healthy of this HealthLog. # noqa: E501 + :type is_healthy: bool + :param details: The details of this HealthLog. # noqa: E501 :type details: str """ self.swagger_types = { 'log_time': datetime, + 'is_healthy': bool, 'details': str } self.attribute_map = { 'log_time': 'log_time', + 'is_healthy': 'is_healthy', 'details': 'details' } self._log_time = log_time + self._is_healthy = is_healthy self._details = details @classmethod @@ -40,27 +45,27 @@ class HealthInfo(Model): :param dikt: A dict. :type: dict - :return: The HealthInfo of this HealthInfo. # noqa: E501 - :rtype: HealthInfo + :return: The HealthLog of this HealthLog. # noqa: E501 + :rtype: HealthLog """ return util.deserialize_model(dikt, cls) @property def log_time(self): - """Gets the log_time of this HealthInfo. + """Gets the log_time of this HealthLog. - :return: The log_time of this HealthInfo. + :return: The log_time of this HealthLog. :rtype: datetime """ return self._log_time @log_time.setter def log_time(self, log_time): - """Sets the log_time of this HealthInfo. + """Sets the log_time of this HealthLog. - :param log_time: The log_time of this HealthInfo. + :param log_time: The log_time of this HealthLog. :type log_time: datetime """ if log_time is None: @@ -68,22 +73,45 @@ class HealthInfo(Model): self._log_time = log_time + @property + def is_healthy(self): + """Gets the is_healthy of this HealthLog. + + + :return: The is_healthy of this HealthLog. + :rtype: bool + """ + return self._is_healthy + + @is_healthy.setter + def is_healthy(self, is_healthy): + """Sets the is_healthy of this HealthLog. + + + :param is_healthy: The is_healthy of this HealthLog. + :type is_healthy: bool + """ + if is_healthy is None: + raise ValueError("Invalid value for `is_healthy`, must not be `None`") # noqa: E501 + + self._is_healthy = is_healthy + @property def details(self): - """Gets the details of this HealthInfo. + """Gets the details of this HealthLog. - :return: The details of this HealthInfo. + :return: The details of this HealthLog. :rtype: str """ return self._details @details.setter def details(self, details): - """Sets the details of this HealthInfo. + """Sets the details of this HealthLog. - :param details: The details of this HealthInfo. + :param details: The details of this HealthLog. :type details: str """ if details is None: diff --git a/src/rest/models/play_log_entry.py b/src/rest/models/play_log.py similarity index 62% rename from src/rest/models/play_log_entry.py rename to src/rest/models/play_log.py index 5cf3831fa73857b7365ab5740b93590360686286..97338fc882bd45f697c1337b4a985e899e9bab5d 100644 --- a/src/rest/models/play_log_entry.py +++ b/src/rest/models/play_log.py @@ -9,31 +9,31 @@ from src.rest.models.base_model_ import Model from src.rest import util -class PlayLogEntry(Model): +class PlayLog(Model): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None, timeslot_id=None, show_name=None, log_source=None): # noqa: E501 - """PlayLogEntry - a model defined in Swagger + """PlayLog - a model defined in Swagger - :param track_start: The track_start of this PlayLogEntry. # noqa: E501 + :param track_start: The track_start of this PlayLog. # noqa: E501 :type track_start: datetime - :param track_artist: The track_artist of this PlayLogEntry. # noqa: E501 + :param track_artist: The track_artist of this PlayLog. # noqa: E501 :type track_artist: str - :param track_album: The track_album of this PlayLogEntry. # noqa: E501 + :param track_album: The track_album of this PlayLog. # noqa: E501 :type track_album: str - :param track_title: The track_title of this PlayLogEntry. # noqa: E501 + :param track_title: The track_title of this PlayLog. # noqa: E501 :type track_title: str - :param track_duration: The track_duration of this PlayLogEntry. # noqa: E501 + :param track_duration: The track_duration of this PlayLog. # noqa: E501 :type track_duration: int - :param track_type: The track_type of this PlayLogEntry. # noqa: E501 + :param track_type: The track_type of this PlayLog. # noqa: E501 :type track_type: int - :param timeslot_id: The timeslot_id of this PlayLogEntry. # noqa: E501 + :param timeslot_id: The timeslot_id of this PlayLog. # noqa: E501 :type timeslot_id: int - :param show_name: The show_name of this PlayLogEntry. # noqa: E501 + :param show_name: The show_name of this PlayLog. # noqa: E501 :type show_name: str - :param log_source: The log_source of this PlayLogEntry. # noqa: E501 + :param log_source: The log_source of this PlayLog. # noqa: E501 :type log_source: int """ self.swagger_types = { @@ -75,27 +75,27 @@ class PlayLogEntry(Model): :param dikt: A dict. :type: dict - :return: The PlayLogEntry of this PlayLogEntry. # noqa: E501 - :rtype: PlayLogEntry + :return: The PlayLog of this PlayLog. # noqa: E501 + :rtype: PlayLog """ return util.deserialize_model(dikt, cls) @property def track_start(self): - """Gets the track_start of this PlayLogEntry. + """Gets the track_start of this PlayLog. - :return: The track_start of this PlayLogEntry. + :return: The track_start of this PlayLog. :rtype: datetime """ return self._track_start @track_start.setter def track_start(self, track_start): - """Sets the track_start of this PlayLogEntry. + """Sets the track_start of this PlayLog. - :param track_start: The track_start of this PlayLogEntry. + :param track_start: The track_start of this PlayLog. :type track_start: datetime """ if track_start is None: @@ -105,20 +105,20 @@ class PlayLogEntry(Model): @property def track_artist(self): - """Gets the track_artist of this PlayLogEntry. + """Gets the track_artist of this PlayLog. - :return: The track_artist of this PlayLogEntry. + :return: The track_artist of this PlayLog. :rtype: str """ return self._track_artist @track_artist.setter def track_artist(self, track_artist): - """Sets the track_artist of this PlayLogEntry. + """Sets the track_artist of this PlayLog. - :param track_artist: The track_artist of this PlayLogEntry. + :param track_artist: The track_artist of this PlayLog. :type track_artist: str """ @@ -126,20 +126,20 @@ class PlayLogEntry(Model): @property def track_album(self): - """Gets the track_album of this PlayLogEntry. + """Gets the track_album of this PlayLog. - :return: The track_album of this PlayLogEntry. + :return: The track_album of this PlayLog. :rtype: str """ return self._track_album @track_album.setter def track_album(self, track_album): - """Sets the track_album of this PlayLogEntry. + """Sets the track_album of this PlayLog. - :param track_album: The track_album of this PlayLogEntry. + :param track_album: The track_album of this PlayLog. :type track_album: str """ @@ -147,20 +147,20 @@ class PlayLogEntry(Model): @property def track_title(self): - """Gets the track_title of this PlayLogEntry. + """Gets the track_title of this PlayLog. - :return: The track_title of this PlayLogEntry. + :return: The track_title of this PlayLog. :rtype: str """ return self._track_title @track_title.setter def track_title(self, track_title): - """Sets the track_title of this PlayLogEntry. + """Sets the track_title of this PlayLog. - :param track_title: The track_title of this PlayLogEntry. + :param track_title: The track_title of this PlayLog. :type track_title: str """ @@ -168,20 +168,20 @@ class PlayLogEntry(Model): @property def track_duration(self): - """Gets the track_duration of this PlayLogEntry. + """Gets the track_duration of this PlayLog. - :return: The track_duration of this PlayLogEntry. + :return: The track_duration of this PlayLog. :rtype: int """ return self._track_duration @track_duration.setter def track_duration(self, track_duration): - """Sets the track_duration of this PlayLogEntry. + """Sets the track_duration of this PlayLog. - :param track_duration: The track_duration of this PlayLogEntry. + :param track_duration: The track_duration of this PlayLog. :type track_duration: int """ @@ -189,20 +189,20 @@ class PlayLogEntry(Model): @property def track_type(self): - """Gets the track_type of this PlayLogEntry. + """Gets the track_type of this PlayLog. - :return: The track_type of this PlayLogEntry. + :return: The track_type of this PlayLog. :rtype: int """ return self._track_type @track_type.setter def track_type(self, track_type): - """Sets the track_type of this PlayLogEntry. + """Sets the track_type of this PlayLog. - :param track_type: The track_type of this PlayLogEntry. + :param track_type: The track_type of this PlayLog. :type track_type: int """ @@ -210,20 +210,20 @@ class PlayLogEntry(Model): @property def timeslot_id(self): - """Gets the timeslot_id of this PlayLogEntry. + """Gets the timeslot_id of this PlayLog. - :return: The timeslot_id of this PlayLogEntry. + :return: The timeslot_id of this PlayLog. :rtype: int """ return self._timeslot_id @timeslot_id.setter def timeslot_id(self, timeslot_id): - """Sets the timeslot_id of this PlayLogEntry. + """Sets the timeslot_id of this PlayLog. - :param timeslot_id: The timeslot_id of this PlayLogEntry. + :param timeslot_id: The timeslot_id of this PlayLog. :type timeslot_id: int """ @@ -231,20 +231,20 @@ class PlayLogEntry(Model): @property def show_name(self): - """Gets the show_name of this PlayLogEntry. + """Gets the show_name of this PlayLog. - :return: The show_name of this PlayLogEntry. + :return: The show_name of this PlayLog. :rtype: str """ return self._show_name @show_name.setter def show_name(self, show_name): - """Sets the show_name of this PlayLogEntry. + """Sets the show_name of this PlayLog. - :param show_name: The show_name of this PlayLogEntry. + :param show_name: The show_name of this PlayLog. :type show_name: str """ @@ -252,20 +252,20 @@ class PlayLogEntry(Model): @property def log_source(self): - """Gets the log_source of this PlayLogEntry. + """Gets the log_source of this PlayLog. - :return: The log_source of this PlayLogEntry. + :return: The log_source of this PlayLog. :rtype: int """ return self._log_source @log_source.setter def log_source(self, log_source): - """Sets the log_source of this PlayLogEntry. + """Sets the log_source of this PlayLog. - :param log_source: The log_source of this PlayLogEntry. + :param log_source: The log_source of this PlayLog. :type log_source: int """ diff --git a/src/rest/models/playlist.py b/src/rest/models/playlist.py deleted file mode 100644 index 15d7f680d7fc2e9f47cb300aec7cdf522437c6b5..0000000000000000000000000000000000000000 --- a/src/rest/models/playlist.py +++ /dev/null @@ -1,227 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from src.rest.models.base_model_ import Model -from src.rest.models.playlist_entry import PlaylistEntry # noqa: F401,E501 -from src.rest import util - - -class Playlist(Model): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - def __init__(self, show_name=None, schedule_id=None, schedule_start=None, schedule_end=None, playlist_id=None, fallback_type=None, entries=None): # noqa: E501 - """Playlist - a model defined in Swagger - - :param show_name: The show_name of this Playlist. # noqa: E501 - :type show_name: str - :param schedule_id: The schedule_id of this Playlist. # noqa: E501 - :type schedule_id: int - :param schedule_start: The schedule_start of this Playlist. # noqa: E501 - :type schedule_start: datetime - :param schedule_end: The schedule_end of this Playlist. # noqa: E501 - :type schedule_end: datetime - :param playlist_id: The playlist_id of this Playlist. # noqa: E501 - :type playlist_id: int - :param fallback_type: The fallback_type of this Playlist. # noqa: E501 - :type fallback_type: int - :param entries: The entries of this Playlist. # noqa: E501 - :type entries: List[PlaylistEntry] - """ - self.swagger_types = { - 'show_name': str, - 'schedule_id': int, - 'schedule_start': datetime, - 'schedule_end': datetime, - 'playlist_id': int, - 'fallback_type': int, - 'entries': List[PlaylistEntry] - } - - self.attribute_map = { - 'show_name': 'show_name', - 'schedule_id': 'schedule_id', - 'schedule_start': 'schedule_start', - 'schedule_end': 'schedule_end', - 'playlist_id': 'playlist_id', - 'fallback_type': 'fallback_type', - 'entries': 'entries' - } - self._show_name = show_name - self._schedule_id = schedule_id - self._schedule_start = schedule_start - self._schedule_end = schedule_end - self._playlist_id = playlist_id - self._fallback_type = fallback_type - self._entries = entries - - @classmethod - def from_dict(cls, dikt): - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Playlist of this Playlist. # noqa: E501 - :rtype: Playlist - """ - return util.deserialize_model(dikt, cls) - - @property - def show_name(self): - """Gets the show_name of this Playlist. - - - :return: The show_name of this Playlist. - :rtype: str - """ - return self._show_name - - @show_name.setter - def show_name(self, show_name): - """Sets the show_name of this Playlist. - - - :param show_name: The show_name of this Playlist. - :type show_name: str - """ - if show_name is None: - raise ValueError("Invalid value for `show_name`, must not be `None`") # noqa: E501 - - self._show_name = show_name - - @property - def schedule_id(self): - """Gets the schedule_id of this Playlist. - - - :return: The schedule_id of this Playlist. - :rtype: int - """ - return self._schedule_id - - @schedule_id.setter - def schedule_id(self, schedule_id): - """Sets the schedule_id of this Playlist. - - - :param schedule_id: The schedule_id of this Playlist. - :type schedule_id: int - """ - - self._schedule_id = schedule_id - - @property - def schedule_start(self): - """Gets the schedule_start of this Playlist. - - - :return: The schedule_start of this Playlist. - :rtype: datetime - """ - return self._schedule_start - - @schedule_start.setter - def schedule_start(self, schedule_start): - """Sets the schedule_start of this Playlist. - - - :param schedule_start: The schedule_start of this Playlist. - :type schedule_start: datetime - """ - if schedule_start is None: - raise ValueError("Invalid value for `schedule_start`, must not be `None`") # noqa: E501 - - self._schedule_start = schedule_start - - @property - def schedule_end(self): - """Gets the schedule_end of this Playlist. - - - :return: The schedule_end of this Playlist. - :rtype: datetime - """ - return self._schedule_end - - @schedule_end.setter - def schedule_end(self, schedule_end): - """Sets the schedule_end of this Playlist. - - - :param schedule_end: The schedule_end of this Playlist. - :type schedule_end: datetime - """ - if schedule_end is None: - raise ValueError("Invalid value for `schedule_end`, must not be `None`") # noqa: E501 - - self._schedule_end = schedule_end - - @property - def playlist_id(self): - """Gets the playlist_id of this Playlist. - - - :return: The playlist_id of this Playlist. - :rtype: int - """ - return self._playlist_id - - @playlist_id.setter - def playlist_id(self, playlist_id): - """Sets the playlist_id of this Playlist. - - - :param playlist_id: The playlist_id of this Playlist. - :type playlist_id: int - """ - - self._playlist_id = playlist_id - - @property - def fallback_type(self): - """Gets the fallback_type of this Playlist. - - - :return: The fallback_type of this Playlist. - :rtype: int - """ - return self._fallback_type - - @fallback_type.setter - def fallback_type(self, fallback_type): - """Sets the fallback_type of this Playlist. - - - :param fallback_type: The fallback_type of this Playlist. - :type fallback_type: int - """ - - self._fallback_type = fallback_type - - @property - def entries(self): - """Gets the entries of this Playlist. - - - :return: The entries of this Playlist. - :rtype: List[PlaylistEntry] - """ - return self._entries - - @entries.setter - def entries(self, entries): - """Sets the entries of this Playlist. - - - :param entries: The entries of this Playlist. - :type entries: List[PlaylistEntry] - """ - if entries is None: - raise ValueError("Invalid value for `entries`, must not be `None`") # noqa: E501 - - self._entries = entries diff --git a/src/rest/models/playlist_entry.py b/src/rest/models/playlist_entry.py deleted file mode 100644 index 845902c7a8b4063d133f6e22e98166d2a5ce3952..0000000000000000000000000000000000000000 --- a/src/rest/models/playlist_entry.py +++ /dev/null @@ -1,168 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from src.rest.models.base_model_ import Model -from src.rest import util - - -class PlaylistEntry(Model): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - def __init__(self, artist=None, album=None, title=None, duration=None, type=None): # noqa: E501 - """PlaylistEntry - a model defined in Swagger - - :param artist: The artist of this PlaylistEntry. # noqa: E501 - :type artist: str - :param album: The album of this PlaylistEntry. # noqa: E501 - :type album: str - :param title: The title of this PlaylistEntry. # noqa: E501 - :type title: str - :param duration: The duration of this PlaylistEntry. # noqa: E501 - :type duration: int - :param type: The type of this PlaylistEntry. # noqa: E501 - :type type: int - """ - self.swagger_types = { - 'artist': str, - 'album': str, - 'title': str, - 'duration': int, - 'type': int - } - - self.attribute_map = { - 'artist': 'artist', - 'album': 'album', - 'title': 'title', - 'duration': 'duration', - 'type': 'type' - } - self._artist = artist - self._album = album - self._title = title - self._duration = duration - self._type = type - - @classmethod - def from_dict(cls, dikt): - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The PlaylistEntry of this PlaylistEntry. # noqa: E501 - :rtype: PlaylistEntry - """ - return util.deserialize_model(dikt, cls) - - @property - def artist(self): - """Gets the artist of this PlaylistEntry. - - - :return: The artist of this PlaylistEntry. - :rtype: str - """ - return self._artist - - @artist.setter - def artist(self, artist): - """Sets the artist of this PlaylistEntry. - - - :param artist: The artist of this PlaylistEntry. - :type artist: str - """ - - self._artist = artist - - @property - def album(self): - """Gets the album of this PlaylistEntry. - - - :return: The album of this PlaylistEntry. - :rtype: str - """ - return self._album - - @album.setter - def album(self, album): - """Sets the album of this PlaylistEntry. - - - :param album: The album of this PlaylistEntry. - :type album: str - """ - - self._album = album - - @property - def title(self): - """Gets the title of this PlaylistEntry. - - - :return: The title of this PlaylistEntry. - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this PlaylistEntry. - - - :param title: The title of this PlaylistEntry. - :type title: str - """ - if title is None: - raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 - - self._title = title - - @property - def duration(self): - """Gets the duration of this PlaylistEntry. - - - :return: The duration of this PlaylistEntry. - :rtype: int - """ - return self._duration - - @duration.setter - def duration(self, duration): - """Sets the duration of this PlaylistEntry. - - - :param duration: The duration of this PlaylistEntry. - :type duration: int - """ - - self._duration = duration - - @property - def type(self): - """Gets the type of this PlaylistEntry. - - - :return: The type of this PlaylistEntry. - :rtype: int - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this PlaylistEntry. - - - :param type: The type of this PlaylistEntry. - :type type: int - """ - - self._type = type diff --git a/src/rest/models/status_entry.py b/src/rest/models/status_entry.py deleted file mode 100644 index b83dd74bed3caf94b2cdcb9956be94594c40af20..0000000000000000000000000000000000000000 --- a/src/rest/models/status_entry.py +++ /dev/null @@ -1,176 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from src.rest.models.base_model_ import Model -from src.rest import util - - -class StatusEntry(Model): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - def __init__(self, log_time=None, engine_number=None, engine_host=None, is_healthy=None, is_active=None): # noqa: E501 - """StatusEntry - a model defined in Swagger - - :param log_time: The log_time of this StatusEntry. # noqa: E501 - :type log_time: datetime - :param engine_number: The engine_number of this StatusEntry. # noqa: E501 - :type engine_number: int - :param engine_host: The engine_host of this StatusEntry. # noqa: E501 - :type engine_host: str - :param is_healthy: The is_healthy of this StatusEntry. # noqa: E501 - :type is_healthy: bool - :param is_active: The is_active of this StatusEntry. # noqa: E501 - :type is_active: bool - """ - self.swagger_types = { - 'log_time': datetime, - 'engine_number': int, - 'engine_host': str, - 'is_healthy': bool, - 'is_active': bool - } - - self.attribute_map = { - 'log_time': 'log_time', - 'engine_number': 'engine_number', - 'engine_host': 'engine_host', - 'is_healthy': 'is_healthy', - 'is_active': 'is_active' - } - self._log_time = log_time - self._engine_number = engine_number - self._engine_host = engine_host - self._is_healthy = is_healthy - self._is_active = is_active - - @classmethod - def from_dict(cls, dikt): - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The StatusEntry of this StatusEntry. # noqa: E501 - :rtype: StatusEntry - """ - return util.deserialize_model(dikt, cls) - - @property - def log_time(self): - """Gets the log_time of this StatusEntry. - - - :return: The log_time of this StatusEntry. - :rtype: datetime - """ - return self._log_time - - @log_time.setter - def log_time(self, log_time): - """Sets the log_time of this StatusEntry. - - - :param log_time: The log_time of this StatusEntry. - :type log_time: datetime - """ - if log_time is None: - raise ValueError("Invalid value for `log_time`, must not be `None`") # noqa: E501 - - self._log_time = log_time - - @property - def engine_number(self): - """Gets the engine_number of this StatusEntry. - - - :return: The engine_number of this StatusEntry. - :rtype: int - """ - return self._engine_number - - @engine_number.setter - def engine_number(self, engine_number): - """Sets the engine_number of this StatusEntry. - - - :param engine_number: The engine_number of this StatusEntry. - :type engine_number: int - """ - if engine_number is None: - raise ValueError("Invalid value for `engine_number`, must not be `None`") # noqa: E501 - - self._engine_number = engine_number - - @property - def engine_host(self): - """Gets the engine_host of this StatusEntry. - - - :return: The engine_host of this StatusEntry. - :rtype: str - """ - return self._engine_host - - @engine_host.setter - def engine_host(self, engine_host): - """Sets the engine_host of this StatusEntry. - - - :param engine_host: The engine_host of this StatusEntry. - :type engine_host: str - """ - if engine_host is None: - raise ValueError("Invalid value for `engine_host`, must not be `None`") # noqa: E501 - - self._engine_host = engine_host - - @property - def is_healthy(self): - """Gets the is_healthy of this StatusEntry. - - - :return: The is_healthy of this StatusEntry. - :rtype: bool - """ - return self._is_healthy - - @is_healthy.setter - def is_healthy(self, is_healthy): - """Sets the is_healthy of this StatusEntry. - - - :param is_healthy: The is_healthy of this StatusEntry. - :type is_healthy: bool - """ - if is_healthy is None: - raise ValueError("Invalid value for `is_healthy`, must not be `None`") # noqa: E501 - - self._is_healthy = is_healthy - - @property - def is_active(self): - """Gets the is_active of this StatusEntry. - - - :return: The is_active of this StatusEntry. - :rtype: bool - """ - return self._is_active - - @is_active.setter - def is_active(self, is_active): - """Sets the is_active of this StatusEntry. - - - :param is_active: The is_active of this StatusEntry. - :type is_active: bool - """ - if is_active is None: - raise ValueError("Invalid value for `is_active`, must not be `None`") # noqa: E501 - - self._is_active = is_active diff --git a/src/rest/models/timeslot.py b/src/rest/models/timeslot.py index 4de25965a696c9ec5348610fcbb7a3c052246bef..04dcde3c82c72aa2d55e8a4d4b729cac1e36a224 100644 --- a/src/rest/models/timeslot.py +++ b/src/rest/models/timeslot.py @@ -6,7 +6,7 @@ from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from src.rest.models.base_model_ import Model -from src.rest.models.playlist_entry import PlaylistEntry # noqa: F401,E501 +from src.rest.models.track import Track # noqa: F401,E501 from src.rest import util @@ -15,7 +15,7 @@ class Timeslot(Model): Do not edit the class manually. """ - def __init__(self, show_name=None, schedule_id=None, timeslot_id=None, timeslot_start=None, timeslot_end=None, playlist_id=None, fallback_type=None, playlist_entries=None): # noqa: E501 + def __init__(self, show_name=None, schedule_id=None, timeslot_id=None, timeslot_start=None, timeslot_end=None, playlist_id=None, fallback_type=None, tracks=None): # noqa: E501 """Timeslot - a model defined in Swagger :param show_name: The show_name of this Timeslot. # noqa: E501 @@ -32,8 +32,8 @@ class Timeslot(Model): :type playlist_id: int :param fallback_type: The fallback_type of this Timeslot. # noqa: E501 :type fallback_type: int - :param playlist_entries: The playlist_entries of this Timeslot. # noqa: E501 - :type playlist_entries: List[PlaylistEntry] + :param tracks: The tracks of this Timeslot. # noqa: E501 + :type tracks: List[Track] """ self.swagger_types = { 'show_name': str, @@ -43,7 +43,7 @@ class Timeslot(Model): 'timeslot_end': datetime, 'playlist_id': int, 'fallback_type': int, - 'playlist_entries': List[PlaylistEntry] + 'tracks': List[Track] } self.attribute_map = { @@ -54,7 +54,7 @@ class Timeslot(Model): 'timeslot_end': 'timeslot_end', 'playlist_id': 'playlist_id', 'fallback_type': 'fallback_type', - 'playlist_entries': 'playlist_entries' + 'tracks': 'tracks' } self._show_name = show_name self._schedule_id = schedule_id @@ -63,7 +63,7 @@ class Timeslot(Model): self._timeslot_end = timeslot_end self._playlist_id = playlist_id self._fallback_type = fallback_type - self._playlist_entries = playlist_entries + self._tracks = tracks @classmethod def from_dict(cls, dikt): @@ -230,24 +230,24 @@ class Timeslot(Model): self._fallback_type = fallback_type @property - def playlist_entries(self): - """Gets the playlist_entries of this Timeslot. + def tracks(self): + """Gets the tracks of this Timeslot. - :return: The playlist_entries of this Timeslot. - :rtype: List[PlaylistEntry] + :return: The tracks of this Timeslot. + :rtype: List[Track] """ - return self._playlist_entries + return self._tracks - @playlist_entries.setter - def playlist_entries(self, playlist_entries): - """Sets the playlist_entries of this Timeslot. + @tracks.setter + def tracks(self, tracks): + """Sets the tracks of this Timeslot. - :param playlist_entries: The playlist_entries of this Timeslot. - :type playlist_entries: List[PlaylistEntry] + :param tracks: The tracks of this Timeslot. + :type tracks: List[Track] """ - if playlist_entries is None: - raise ValueError("Invalid value for `playlist_entries`, must not be `None`") # noqa: E501 + if tracks is None: + raise ValueError("Invalid value for `tracks`, must not be `None`") # noqa: E501 - self._playlist_entries = playlist_entries + self._tracks = tracks diff --git a/src/rest/models/track.py b/src/rest/models/track.py new file mode 100644 index 0000000000000000000000000000000000000000..ac5a89579a9cac386bbf358a30e22ed9f490956c --- /dev/null +++ b/src/rest/models/track.py @@ -0,0 +1,194 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from src.rest.models.base_model_ import Model +from src.rest import util + + +class Track(Model): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + def __init__(self, track_start=None, track_artist=None, track_album=None, track_title=None, track_duration=None, track_type=None): # noqa: E501 + """Track - a model defined in Swagger + + :param track_start: The track_start of this Track. # noqa: E501 + :type track_start: datetime + :param track_artist: The track_artist of this Track. # noqa: E501 + :type track_artist: str + :param track_album: The track_album of this Track. # noqa: E501 + :type track_album: str + :param track_title: The track_title of this Track. # noqa: E501 + :type track_title: str + :param track_duration: The track_duration of this Track. # noqa: E501 + :type track_duration: int + :param track_type: The track_type of this Track. # noqa: E501 + :type track_type: int + """ + self.swagger_types = { + 'track_start': datetime, + 'track_artist': str, + 'track_album': str, + 'track_title': str, + 'track_duration': int, + 'track_type': int + } + + self.attribute_map = { + 'track_start': 'track_start', + 'track_artist': 'track_artist', + 'track_album': 'track_album', + 'track_title': 'track_title', + 'track_duration': 'track_duration', + 'track_type': 'track_type' + } + self._track_start = track_start + self._track_artist = track_artist + self._track_album = track_album + self._track_title = track_title + self._track_duration = track_duration + self._track_type = track_type + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Track of this Track. # noqa: E501 + :rtype: Track + """ + return util.deserialize_model(dikt, cls) + + @property + def track_start(self): + """Gets the track_start of this Track. + + + :return: The track_start of this Track. + :rtype: datetime + """ + return self._track_start + + @track_start.setter + def track_start(self, track_start): + """Sets the track_start of this Track. + + + :param track_start: The track_start of this Track. + :type track_start: datetime + """ + if track_start is None: + raise ValueError("Invalid value for `track_start`, must not be `None`") # noqa: E501 + + self._track_start = track_start + + @property + def track_artist(self): + """Gets the track_artist of this Track. + + + :return: The track_artist of this Track. + :rtype: str + """ + return self._track_artist + + @track_artist.setter + def track_artist(self, track_artist): + """Sets the track_artist of this Track. + + + :param track_artist: The track_artist of this Track. + :type track_artist: str + """ + + self._track_artist = track_artist + + @property + def track_album(self): + """Gets the track_album of this Track. + + + :return: The track_album of this Track. + :rtype: str + """ + return self._track_album + + @track_album.setter + def track_album(self, track_album): + """Sets the track_album of this Track. + + + :param track_album: The track_album of this Track. + :type track_album: str + """ + + self._track_album = track_album + + @property + def track_title(self): + """Gets the track_title of this Track. + + + :return: The track_title of this Track. + :rtype: str + """ + return self._track_title + + @track_title.setter + def track_title(self, track_title): + """Sets the track_title of this Track. + + + :param track_title: The track_title of this Track. + :type track_title: str + """ + + self._track_title = track_title + + @property + def track_duration(self): + """Gets the track_duration of this Track. + + + :return: The track_duration of this Track. + :rtype: int + """ + return self._track_duration + + @track_duration.setter + def track_duration(self, track_duration): + """Sets the track_duration of this Track. + + + :param track_duration: The track_duration of this Track. + :type track_duration: int + """ + + self._track_duration = track_duration + + @property + def track_type(self): + """Gets the track_type of this Track. + + + :return: The track_type of this Track. + :rtype: int + """ + return self._track_type + + @track_type.setter + def track_type(self, track_type): + """Sets the track_type of this Track. + + + :param track_type: The track_type of this Track. + :type track_type: int + """ + + self._track_type = track_type diff --git a/src/rest/swagger/swagger.yaml b/src/rest/swagger/swagger.yaml index ce882bf1e81856252aa7645127545270d139ee7d..0675ebe79b7f3dc7281bc21f9585bfd4b37ef034 100644 --- a/src/rest/swagger/swagger.yaml +++ b/src/rest/swagger/swagger.yaml @@ -72,7 +72,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/PlayLogEntry' + $ref: '#/components/schemas/PlayLog' x-content-type: application/json "400": description: bad input parameter @@ -91,7 +91,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PlayLogEntry' + $ref: '#/components/schemas/PlayLog' "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.public_controller @@ -125,7 +125,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PlayLogEntry' + $ref: '#/components/schemas/PlayLog' required: true responses: "200": @@ -174,6 +174,15 @@ paths: minimum: 1 type: integer default: 50 + - name: skip_synced + in: query + description: If true only returns items which are in unsynced state on the + main node + required: false + style: form + explode: true + schema: + type: boolean responses: "200": description: search results matching criteria @@ -182,7 +191,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/PlayLogEntry' + $ref: '#/components/schemas/PlayLog' x-content-type: application/json "400": description: bad input parameter @@ -212,39 +221,40 @@ paths: schema: type: array items: - $ref: '#/components/schemas/PlayLogEntry' + $ref: '#/components/schemas/PlayLog' x-content-type: application/json "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller - /engine/current: + /source/active: get: tags: - internal - summary: Get active engine + summary: Get active play-out source (engine1, engine2) description: | - Retrieves the status entry of the currently active engine - operationId: get_active_engine + Retrieves the status entry of the currently active source (engine 1, 2 or other source) + operationId: get_active_source responses: "200": - description: report matching criteria + description: source number content: application/json: schema: - $ref: '#/components/schemas/StatusEntry' + type: integer + x-content-type: application/json "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller - /engine/{engine_number}/health: - get: + /source/active/{number}: + put: tags: - internal - summary: Get most recent health info + summary: Set active play-out source (engine1, engine2) description: | - Retrieves the most recent health info of the requested engine - operationId: get_engine_health + Activates one engine and deactivates the other + operationId: set_active_source parameters: - - name: engine_number + - name: number in: path description: Number of the engine required: true @@ -256,23 +266,20 @@ paths: type: integer responses: "200": - description: report matching criteria - content: - application/json: - schema: - $ref: '#/components/schemas/HealthInfo' + description: status updated "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller - post: + /source/health/{number}: + get: tags: - internal - summary: Log health info + summary: Get most recent health info description: | - Logs another health entry for the given engine - operationId: log_engine_health + Retrieves the most recent health info of the requested engine + operationId: get_source_health parameters: - - name: engine_number + - name: number in: path description: Number of the engine required: true @@ -284,20 +291,23 @@ paths: type: integer responses: "200": - description: health info logged + description: report matching criteria + content: + application/json: + schema: + $ref: '#/components/schemas/HealthLog' "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller - /engine/{engine_number}/activate: - put: + post: tags: - internal - summary: Set active engine + summary: Log health info description: | - Activates one engine and deactivates the other - operationId: activate_engine + Logs another health entry for the given engine + operationId: log_source_health parameters: - - name: engine_number + - name: number in: path description: Number of the engine required: true @@ -309,13 +319,44 @@ paths: type: integer responses: "200": - description: status updated + description: health info logged "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller components: schemas: - PlayLogEntry: + Track: + required: + - track_start + type: object + properties: + track_start: + type: string + format: date-time + example: 2020-08-29T09:12:33.001Z + track_artist: + type: string + example: Kyuss + track_album: + type: string + example: '...And the Circus Leaves Town' + track_title: + type: string + example: El Rodeo + track_duration: + type: integer + example: 303 + track_type: + type: integer + example: 2 + example: + track_album: '...And the Circus Leaves Town' + track_start: 2020-08-29T09:12:33.001Z + track_title: El Rodeo + track_artist: Kyuss + track_duration: 303 + track_type: 2 + PlayLog: required: - track_start type: object @@ -335,7 +376,7 @@ components: example: Chomp Samba track_duration: type: integer - example: 303 + example: 808 track_type: type: integer example: 2 @@ -356,13 +397,11 @@ components: log_source: 1 track_artist: Amon Tobin timeslot_id: 1 - track_duration: 303 + track_duration: 808 track_type: 2 - StatusEntry: + HealthLog: required: - - engine_host - - engine_number - - is_active + - details - is_healthy - log_time type: object @@ -371,39 +410,14 @@ components: type: string format: date-time example: 2020-08-29T09:12:33.001Z - engine_number: - maximum: 2 - minimum: 1 - type: integer - engine_host: - type: string - example: engine1.local is_healthy: type: boolean example: true - is_active: - type: boolean - example: true - example: - is_healthy: true - is_active: true - engine_number: 1 - engine_host: engine1.local - log_time: 2020-08-29T09:12:33.001Z - HealthInfo: - required: - - details - - log_time - type: object - properties: - log_time: - type: string - format: date-time - example: 2020-08-29T09:12:33.001Z details: type: string example: Stringified JSON Object example: + is_healthy: true details: Stringified JSON Object log_time: 2020-08-29T09:12:33.001Z ClockInfo: @@ -412,7 +426,7 @@ components: type: object properties: current_track: - $ref: '#/components/schemas/PlayLogEntry' + $ref: '#/components/schemas/PlayLog' current_timeslot: $ref: '#/components/schemas/Timeslot' next_timeslot: @@ -423,20 +437,22 @@ components: playlist_id: 38 show_name: Future Pop fallback_type: 0 - playlist_entries: - - duration: 363 - artist: xxyyxx - album: XXYYXX - title: Alone - type: 1 - - duration: 363 - artist: xxyyxx - album: XXYYXX - title: Alone - type: 1 timeslot_start: 2020-08-29T09:12:33.001Z timeslot_id: 42 schedule_id: 23 + tracks: + - track_album: '...And the Circus Leaves Town' + track_start: 2020-08-29T09:12:33.001Z + track_title: El Rodeo + track_artist: Kyuss + track_duration: 303 + track_type: 2 + - track_album: '...And the Circus Leaves Town' + track_start: 2020-08-29T09:12:33.001Z + track_title: El Rodeo + track_artist: Kyuss + track_duration: 303 + track_type: 2 current_track: track_album: Bricolage track_start: 2020-08-29T09:12:33.001Z @@ -445,14 +461,14 @@ components: log_source: 1 track_artist: Amon Tobin timeslot_id: 1 - track_duration: 303 + track_duration: 808 track_type: 2 Timeslot: required: - - playlist_entries - show_name - timeslot_end - timeslot_start + - tracks type: object properties: show_name: @@ -478,55 +494,31 @@ components: fallback_type: type: integer example: 0 - playlist_entries: + tracks: type: array items: - $ref: '#/components/schemas/PlaylistEntry' + $ref: '#/components/schemas/Track' example: timeslot_end: 2020-08-29T09:12:33.001Z playlist_id: 38 show_name: Future Pop fallback_type: 0 - playlist_entries: - - duration: 363 - artist: xxyyxx - album: XXYYXX - title: Alone - type: 1 - - duration: 363 - artist: xxyyxx - album: XXYYXX - title: Alone - type: 1 timeslot_start: 2020-08-29T09:12:33.001Z timeslot_id: 42 schedule_id: 23 - PlaylistEntry: - required: - - title - type: object - properties: - artist: - type: string - example: xxyyxx - album: - type: string - example: XXYYXX - title: - type: string - example: Alone - duration: - type: integer - example: 363 - type: - type: integer - example: 1 - example: - duration: 363 - artist: xxyyxx - album: XXYYXX - title: Alone - type: 1 + tracks: + - track_album: '...And the Circus Leaves Town' + track_start: 2020-08-29T09:12:33.001Z + track_title: El Rodeo + track_artist: Kyuss + track_duration: 303 + track_type: 2 + - track_album: '...And the Circus Leaves Town' + track_start: 2020-08-29T09:12:33.001Z + track_title: El Rodeo + track_artist: Kyuss + track_duration: 303 + track_type: 2 inline_response_400: type: object properties: diff --git a/src/rest/test/test_internal_controller.py b/src/rest/test/test_internal_controller.py index 4f18483a99a18a9b823700974f74011d44d03949..d63b18bb53a425f633dced75a07177202bd857ab 100644 --- a/src/rest/test/test_internal_controller.py +++ b/src/rest/test/test_internal_controller.py @@ -17,39 +17,28 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. + from __future__ import absolute_import from flask import json from six import BytesIO from src.rest.models.clock_info import ClockInfo # noqa: E501 -org.joda.time.* # noqa: E501 -from src.rest.models.health_info import HealthInfo # noqa: E501 -from src.rest.models.play_log_entry import PlayLogEntry # noqa: E501 -from src.rest.models.status_entry import StatusEntry # noqa: E501 +from src.rest.models.health_log import HealthLog # noqa: E501 +from src.rest.models.inline_response400 import InlineResponse400 # noqa: E501 +from src.rest.models.play_log import PlayLog # noqa: E501 from src.rest.test import BaseTestCase class TestInternalController(BaseTestCase): """InternalController integration test stubs""" - def test_activate_engine(self): - """Test case for activate_engine - - Set active engine - """ - response = self.client.open( - '/api/v1/engine/{engine_number}/activate'.format(engine_number=2), - method='PUT') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - def test_add_playlog(self): """Test case for add_playlog Adds an entry to the playlog """ - body = PlayLogEntry() + body = PlayLog() response = self.client.open( '/playlog/store', method='POST', @@ -69,35 +58,35 @@ class TestInternalController(BaseTestCase): self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) - def test_get_active_engine(self): - """Test case for get_active_engine + def test_get_active_source(self): + """Test case for get_active_source - Get active engine + Get active play-out source (engine1, engine2) """ response = self.client.open( - '/api/v1/engine/current', + '/api/v1/source/active', method='GET') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) - def test_get_engine_health(self): - """Test case for get_engine_health + def test_get_report(self): + """Test case for get_report - Get most recent health info + Report for one month """ response = self.client.open( - '/api/v1/engine/{engine_number}/health'.format(engine_number=2), + '/api/v1/playlog/report/{year_month}'.format(year_month='year_month_example'), method='GET') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) - def test_get_report(self): - """Test case for get_report + def test_get_source_health(self): + """Test case for get_source_health - Report for one month + Get most recent health info """ response = self.client.open( - '/api/v1/playlog/report/{year_month}'.format(year_month='year_month_example'), + '/api/v1/source/health/{number}'.format(number=2), method='GET') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) @@ -108,25 +97,37 @@ class TestInternalController(BaseTestCase): List tracks in the play-log since the given timestamp """ query_string = [('page', 56), - ('limit', 200)] + ('limit', 200), + ('skip_synced', true)] response = self.client.open( - '/api/v1/playlog/since/{date_time}'.format(date_time='2013-10-20T19:20:30+01:00'), + '/api/v1/playlog/since/{date_time}'.format(date_time='date_time_example'), method='GET', query_string=query_string) self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) - def test_log_engine_health(self): - """Test case for log_engine_health + def test_log_source_health(self): + """Test case for log_source_health Log health info """ response = self.client.open( - '/api/v1/engine/{engine_number}/health'.format(engine_number=2), + '/api/v1/source/health/{number}'.format(number=2), method='POST') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) + def test_set_active_source(self): + """Test case for set_active_source + + Set active play-out source (engine1, engine2) + """ + response = self.client.open( + '/api/v1/source/active/{number}'.format(number=2), + method='PUT') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + if __name__ == '__main__': import unittest diff --git a/src/rest/test/test_public_controller.py b/src/rest/test/test_public_controller.py index 9fc778017833ab2132850b00694bd9843d3d924c..fb9731cccaa5a77ae5c3ad26c2f5f8daed85af14 100644 --- a/src/rest/test/test_public_controller.py +++ b/src/rest/test/test_public_controller.py @@ -22,7 +22,7 @@ from __future__ import absolute_import from flask import json from six import BytesIO -from src.rest.models.play_log_entry import PlayLogEntry # noqa: E501 +from src.rest.models.play_log import PlayLog # noqa: E501 from src.rest.test import BaseTestCase