From 48c25bffe9312d8f469b4da3b95607a00bca29eb Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 27 Dec 2023 13:34:22 -0700 Subject: [PATCH] fix: Add more API test case stubs --- tests/test_campaigns.py | 146 ++++++++++++++++++++++ tests/test_messages.py | 233 ++++++++++++++++++++++++++++++++++++ tests/test_notifications.py | 74 ++++++++++++ tests/test_orgs.py | 2 +- tests/test_projects.py | 33 +++-- tests/test_tasks.py | 148 +++++++++++++++++++++++ tests/test_users.py | 6 +- 7 files changed, 632 insertions(+), 10 deletions(-) create mode 100755 tests/test_campaigns.py create mode 100755 tests/test_messages.py create mode 100755 tests/test_notifications.py create mode 100755 tests/test_tasks.py diff --git a/tests/test_campaigns.py b/tests/test_campaigns.py new file mode 100755 index 00000000..83ff5dd6 --- /dev/null +++ b/tests/test_campaigns.py @@ -0,0 +1,146 @@ +#!/usr/bin/python3 + +# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# Humanitarian OpenStreetmap Team +# 1100 13th Street NW Suite 800 Washington, D.C. 20005 +# + +import argparse +import logging +import sys +import os +from sys import argv +# from tm_admin.users.users_proto import UsersMessage +#from tm_admin.yamlfile import YamlFile +from tm_admin.users.users import UsersDB +from tm_admin.projects.projects import ProjectsDB +from tm_admin.types_tm import Userrole, Mappinglevel +from datetime import datetime +from tm_admin.users.users_class import UsersTable + +# Instantiate logger +log = logging.getLogger(__name__) + +import tm_admin as tma +rootdir = tma.__path__[0] + +# FIXME: For now these tests assume you have a local postgres installed. One has the TM +# database, the other for tm_admin. + +user = UsersDB('localhost/testdata') +project = ProjectsDB('localhost/testdata') + +def get_campaign(): + """Gets the specified campaign""" + # campaign_id: int) -> Campaign: + log.debug(f"--- get_campaign() unimplemented!") + +def get_campaign_by_name(): + # campaign_name: str) -> Campaign: + log.debug(f"--- get_campaign_by_name() unimplemented!") + +def delete_campaign(): + """Delete campaign for a project""" + # campaign_id: int): + log.debug(f"--- delete_campaign() unimplemented!") + +def get_campaign_as_dto(): + """Gets the specified campaign""" + # campaign_id: int, user_id: int): + log.debug(f"--- get_campaign_as_dto() unimplemented!") + +def get_project_campaigns_as_dto(): + """Gets all the campaigns for a specified project""" + # project_id: int) -> CampaignListDTO: + log.debug(f"--- get_project_campaigns_as_dto() unimplemented!") + +def delete_project_campaign(): + """Delete campaign for a project""" + # project_id: int, campaign_id: int): + log.debug(f"--- delete_project_campaign() unimplemented!") + +def get_all_campaigns(): + """Returns a list of all campaigns""" + # ) -> CampaignListDTO: + log.debug(f"--- get_all_campaigns() unimplemented!") + +def create_campaign(): + """Creates a new campaign""" + # campaign_dto: NewCampaignDTO): + log.debug(f"--- create_campaign() unimplemented!") + +def create_campaign_project(): + """Assign a campaign with a project""" + # dto: CampaignProjectDTO): + log.debug(f"--- create_campaign_project() unimplemented!") + +def create_campaign_organisation(): + """Creates new campaign from DTO""" + # organisation_id: int, campaign_id: int): + log.debug(f"--- create_campaign_organisation() unimplemented!") + +def get_organisation_campaigns_as_dto(): + """Gets all the campaigns for a specified project""" + # organisation_id: int) -> CampaignListDTO: + log.debug(f"--- get_organisation_campaigns_as_dto() unimplemented!") + +def campaign_organisation_exists(): + # campaign_id: int, org_id: int): + log.debug(f"--- campaign_organisation_exists() unimplemented!") + +def delete_organisation_campaign(): + """Delete campaign for a organisation""" + # organisation_id: int, campaign_id: int): + log.debug(f"--- delete_organisation_campaign() unimplemented!") + +def update_campaign(): + # campaign_dto: CampaignDTO, campaign_id: int): + log.debug(f"--- update_campaign() unimplemented!") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("-v", "--verbose", nargs="?", const="0", help="verbose output") + parser.add_argument("-u", "--uri", default='localhost/tm_admin', help="Database URI") + args = parser.parse_args() + # if verbose, dump to the terminal. + log_level = os.getenv("LOG_LEVEL", default="INFO") + if args.verbose is not None: + log_level = logging.DEBUG + + logging.basicConfig( + level=log_level, + # format=("%(asctime)s.%(msecs)03d [%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + format=("[%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + datefmt="%y-%m-%d %H:%M:%S", + stream=sys.stdout, + ) + + get_campaign() + get_campaign_by_name() + delete_campaign() + get_campaign_as_dto() + get_project_campaigns_as_dto() + delete_project_campaign() + get_all_campaigns() + create_campaign() + create_campaign_project() + create_campaign_organisation() + get_organisation_campaigns_as_dto() + campaign_organisation_exists() + delete_organisation_campaign() + update_campaign() diff --git a/tests/test_messages.py b/tests/test_messages.py new file mode 100755 index 00000000..06de6b16 --- /dev/null +++ b/tests/test_messages.py @@ -0,0 +1,233 @@ +#!/usr/bin/python3 + +# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# Humanitarian OpenStreetmap Team +# 1100 13th Street NW Suite 800 Washington, D.C. 20005 +# + +import argparse +import logging +import sys +import os +from sys import argv +# from tm_admin.users.users_proto import UsersMessage +#from tm_admin.yamlfile import YamlFile +from tm_admin.users.users import UsersDB +from tm_admin.projects.projects import ProjectsDB +from tm_admin.types_tm import Userrole, Mappinglevel +from datetime import datetime +from tm_admin.users.users_class import UsersTable + +# Instantiate logger +log = logging.getLogger(__name__) + +import tm_admin as tma +rootdir = tma.__path__[0] + +# FIXME: For now these tests assume you have a local postgres installed. One has the TM +# database, the other for tm_admin. + +user = UsersDB('localhost/testdata') +project = ProjectsDB('localhost/testdata') + +def send_welcome_message(): + """Sends welcome message to new user at Sign up""" + # user: User): + log.debug(f"--- send_welcome_message() unimplemented!") + +def send_message_after_validation(): + # ): + log.debug(f"--- send_message_after_validation() unimplemented!") + # status: int, validated_by: int, mapped_by: int, task_id: int, project_id: int + +def send_message_to_all_contributors(): + # project_id: int, message_dto: MessageDTO): + log.debug(f"--- send_message_to_all_contributors() unimplemented!") + """Sends supplied message to all contributors on specified project.""" + +def _push_messages(): + # messages): + log.debug(f"--- _push_messages() unimplemented!") + +def send_message_after_comment(): + log.debug(f"--- send_message_after_comment() unimplemented!") + # comment_from: int, comment: str, task_id: int, project_id: int + +def send_project_transfer_message(): + log.debug(f"--- send_project_transfer_message() unimplemented!") + # project_id: int, + +def get_user_link(): + # username: str): + log.debug(f"--- get_user_link() unimplemented!") + +def get_team_link(): + # team_name: str, team_id: int, management: bool): + log.debug(f"--- get_team_link() unimplemented!") + +def send_request_to_join_team(): + log.debug(f"--- send_request_to_join_team() unimplemented!") + # from_user: int, from_username: str, to_user: int, team_name: str, team_id: int + +def accept_reject_request_to_join_team(): + log.debug(f"--- accept_reject_request_to_join_team() unimplemented!") + # from_user: int, + +def accept_reject_invitation_request_for_team(): + log.debug(f"--- accept_reject_invitation_request_for_team() unimplemented!") + # from_user: int, + +def send_team_join_notification(): + log.debug(f"--- send_team_join_notification() unimplemented!") + # from_user: int, + +def send_message_after_chat(): + log.debug(f"--- send_message_after_chat() unimplemented!") + # chat_from: int, chat: str, project_id: int, project_name: str + +def send_favorite_project_activities(): + # user_id: int): + log.debug(f"--- send_favorite_project_activities() unimplemented!") + +def resend_email_validation(): + """Resends the email validation email to the logged in user""" + # user_id: int): + log.debug(f"--- resend_email_validation() unimplemented!") + +def _parse_message_for_bulk_mentions(): + log.debug(f"--- _parse_message_for_bulk_mentions() unimplemented!") + # message: str, project_id: int, task_id: int = None + +def _parse_message_for_username(): + log.debug(f"--- _parse_message_for_username() unimplemented!") + # message: str, project_id: int, task_id: int = None + +def has_user_new_messages(): + """Determines if the user has any unread messages""" + # user_id: int) -> dict: + log.debug(f"--- has_user_new_messages() unimplemented!") + +def get_all_messages(): + log.debug(f"--- get_all_messages() unimplemented!") + # user_id: int, + +def get_message(): + """Gets the specified message""" + # message_id: int, user_id: int) -> Message: + log.debug(f"--- get_message() unimplemented!") + +def mark_all_messages_read(): + """Marks all messages as read for the user""" + # user_id: int, message_type: str = None): + log.debug(f"--- mark_all_messages_read() unimplemented!") + +def mark_multiple_messages_read(): + """Marks the specified messages as read for the user""" + # message_ids: list, user_id: int): + log.debug(f"--- mark_multiple_messages_read() unimplemented!") + +def get_message_as_dto(): + """Gets the selected message and marks it as read""" + # message_id: int, user_id: int): + log.debug(f"--- get_message_as_dto() unimplemented!") + +def delete_message(): + """Deletes the specified message""" + # message_id: int, user_id: int): + log.debug(f"--- delete_message() unimplemented!") + +def delete_multiple_messages(): + """Deletes the specified messages to the user""" + # message_ids: list, user_id: int): + log.debug(f"--- delete_multiple_messages() unimplemented!") + +def delete_all_messages(): + """Deletes all messages to the user""" + # user_id: int, message_type: str = None): + log.debug(f"--- delete_all_messages() unimplemented!") + +def get_task_link(): + log.debug(f"--- get_task_link() unimplemented!") + #project_id: int, task_id: int, base_url=None, highlight=False + +def get_project_link(): + log.debug(f"--- get_project_link() unimplemented!") + # project_id: int, + +def get_user_profile_link(): + """Helper method to generate a link to a user profile""" + # user_name: str, base_url=None) -> str: + log.debug(f"--- get_user_profile_link() unimplemented!") + +def get_user_settings_link(): + """Helper method to generate a link to a user profile""" + # section=None, base_url=None) -> str: + log.debug(f"--- get_user_settings_link() unimplemented!") + +def get_organisation_link(): + log.debug(f"--- get_organisation_link() unimplemented!") + # ganisation_id: int, organisation_name: str, base_url=None + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("-v", "--verbose", nargs="?", const="0", help="verbose output") + parser.add_argument("-u", "--uri", default='localhost/tm_admin', help="Database URI") + args = parser.parse_args() + # if verbose, dump to the terminal. + log_level = os.getenv("LOG_LEVEL", default="INFO") + if args.verbose is not None: + log_level = logging.DEBUG + + logging.basicConfig( + level=log_level, + # format=("%(asctime)s.%(msecs)03d [%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + format=("[%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + datefmt="%y-%m-%d %H:%M:%S", + stream=sys.stdout, + ) + + send_welcome_message() + send_message_after_validation() + send_message_to_all_contributors() + _push_messages() + send_message_after_comment() + send_project_transfer_message() + get_user_link() + get_team_link() + send_request_to_join_team() + accept_reject_request_to_join_team() + accept_reject_invitation_request_for_team() + send_team_join_notification() + send_message_after_chat() + send_favorite_project_activities() + resend_email_validation() + _parse_message_for_bulk_mentions() + _parse_message_for_username() + has_user_new_messages() + get_all_messages() + get_message() + mark_all_messages_read() + mark_multiple_messages_read() + get_message_as_dto() + delete_message() + delete_multiple_messages() + delete_all_messages() + get_task_link() + get_project_link() + get_user_profile_link() + get_user_settings_link() + get_organisation_link() diff --git a/tests/test_notifications.py b/tests/test_notifications.py new file mode 100755 index 00000000..a88663c7 --- /dev/null +++ b/tests/test_notifications.py @@ -0,0 +1,74 @@ +#!/usr/bin/python3 + +# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# Humanitarian OpenStreetmap Team +# 1100 13th Street NW Suite 800 Washington, D.C. 20005 +# + +import argparse +import logging +import sys +import os +from sys import argv +# from tm_admin.users.users_proto import UsersMessage +#from tm_admin.yamlfile import YamlFile +from tm_admin.users.users import UsersDB +from tm_admin.projects.projects import ProjectsDB +from tm_admin.types_tm import Userrole, Mappinglevel +from datetime import datetime +from tm_admin.users.users_class import UsersTable + +# Instantiate logger +log = logging.getLogger(__name__) + +import tm_admin as tma +rootdir = tma.__path__[0] + +# FIXME: For now these tests assume you have a local postgres installed. One has the TM +# database, the other for tm_admin. + +user = UsersDB('localhost/testdata') +project = ProjectsDB('localhost/testdata') + +def update(): + # user_id: int): + log.debug(f"--- update() unimplemented!") + +def get_unread_message_count(): + # user_id: int): + log.debug(f"--- get_unread_message_count() unimplemented!") + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("-v", "--verbose", nargs="?", const="0", help="verbose output") + parser.add_argument("-u", "--uri", default='localhost/tm_admin', help="Database URI") + args = parser.parse_args() + # if verbose, dump to the terminal. + log_level = os.getenv("LOG_LEVEL", default="INFO") + if args.verbose is not None: + log_level = logging.DEBUG + + logging.basicConfig( + level=log_level, + # format=("%(asctime)s.%(msecs)03d [%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + format=("[%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + datefmt="%y-%m-%d %H:%M:%S", + stream=sys.stdout, + ) + + update() + get_unread_message_count() diff --git a/tests/test_orgs.py b/tests/test_orgs.py index 93e7a7d4..101eb255 100755 --- a/tests/test_orgs.py +++ b/tests/test_orgs.py @@ -61,7 +61,7 @@ def get_organisation_name_by_id(): log.debug(f"--- get_organisation_name_by_id() ---") id = 1 result = organization.getByWhere(f" id='{id}'") - assert len(result) > 0 and result[0]['name'] == 'Other' + assert len(result) > 0 and result[0][0]['name'] == 'Other' def get_organisations(): # manager_user_id: int): diff --git a/tests/test_projects.py b/tests/test_projects.py index a3cb8d92..cd55e9f4 100755 --- a/tests/test_projects.py +++ b/tests/test_projects.py @@ -28,8 +28,9 @@ #from tm_admin.yamlfile import YamlFile from tm_admin.users.users import UsersDB from tm_admin.tasks.tasks import TasksDB +from tm_admin.teams.teams import TeamsDB from tm_admin.projects.projects import ProjectsDB -from tm_admin.types_tm import Userrole, Mappinglevel +from tm_admin.types_tm import Userrole, Mappinglevel, Teamroles, Permissions from datetime import datetime from tm_admin.users.users_class import UsersTable from tm_admin.projects.projects_class import ProjectsTable @@ -47,6 +48,7 @@ user = UsersDB(dbname) project = ProjectsDB(dbname) task = TasksDB(dbname) +team = TeamsDB(dbname) def get_project_by_id(): # project_id: int) -> Project: @@ -164,6 +166,28 @@ def get_featured_projects(): result = project.getByWhere(f" featured=true") assert len(result) +def evaluate_mapping_permission(): + # project_id: int, user_id: int, mapping_permission: int + log.debug(f"evaluate_mapping_permission()") + uid = 4606673 + pid = 16 + perm = Permissions.ANY + userrole = user.getColumn(uid, 'role') + team = user.getColumn(uid, 'team_members') + mapperms = projects.getColumn(pid, 'mapping_permission') + + #result = team.getByWhere(f" id={uid}") + #print(result) + allowed_roles = [ + Teamroles.TEAM_MAPPER, + Teamroles.TEAM_VALIDATOR, + Teamroles.PROJECT_MANAGER, + ] + + +def evaluate_validation_permission(): + log.debug(f"evaluate_validation_permission() unimplemented!") + def auto_unlock_tasks(): # project_id: int): log.debug(f"auto_unlock_tasks() unimplemented!") @@ -175,6 +199,7 @@ def delete_tasks(): def get_contribs_by_day(): # project_id: int) -> ProjectContribsDTO: + # FIXME: This needs the Task History Table log.debug(f"get_contribs_by_day() unimplemented!") def get_task_for_logged_in_user(): @@ -185,12 +210,6 @@ def get_task_details_for_logged_in_user(): # user_id: int, preferred_locale: str): log.debug(f"get_task_details_for_logged_in_user() unimplemented!") -def evaluate_mapping_permission(): - log.debug(f"evaluate_mapping_permission() unimplemented!") - -def evaluate_validation_permission(): - log.debug(f"evaluate_validation_permission() unimplemented!") - def get_cached_project_summary(): log.debug(f"get_cached_project_summary() unimplemented!") diff --git a/tests/test_tasks.py b/tests/test_tasks.py new file mode 100755 index 00000000..696f2c9a --- /dev/null +++ b/tests/test_tasks.py @@ -0,0 +1,148 @@ +#!/usr/bin/python3 + +# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# Humanitarian OpenStreetmap Team +# 1100 13th Street NW Suite 800 Washington, D.C. 20005 +# + +import argparse +import logging +import sys +import os +from sys import argv +# from tm_admin.users.users_proto import UsersMessage +#from tm_admin.yamlfile import YamlFile +from tm_admin.users.users import UsersDB +from tm_admin.projects.projects import ProjectsDB +from tm_admin.types_tm import Userrole, Mappinglevel +from datetime import datetime +from tm_admin.users.users_class import UsersTable + +# Instantiate logger +log = logging.getLogger(__name__) + +import tm_admin as tma +rootdir = tma.__path__[0] + +# FIXME: For now these tests assume you have a local postgres installed. One has the TM +# database, the other for tm_admin. + +def get_task(): + log.debug(f"--- get_task() unimplemented!") + # task_id: int, project_id: int) -> Task: + +def get_task_as_dto(): + log.debug(f"--- get_task_as_dto( unimplemented!") + # task_id: int, + +def _is_task_undoable(): + """Determines if the current task status can be undone by the logged in user""" + log.debug(f"--- _is_task_undoable() unimplemented!") + #logged_in_user_id: int, task: Task) -> bool: + +def lock_task_for_mapping(): + log.debug(f"--- lock_task_for_mapping() unimplemented!") + # lock_task_dto: LockTaskDTO) -> TaskDTO: + +def unlock_task_after_mapping(): + """Unlocks the task and sets the task history appropriately""" + log.debug(f"--- unlock_task_after_mapping() unimplemented!") + # mapped_task: MappedTaskDTO) -> TaskDTO: + +def stop_mapping_task(): + # stop_task: StopMappingTaskDTO) -> TaskDTO: + log.debug(f"--- stop_mapping_task() unimplemented!") + + """Unlocks the task and revert the task status to the last one""" +def get_task_locked_by_user(): + log.debug(f"--- get_task_locked_by_user() unimplemented!") + # project_id: int, task_id: int, user_id: int) -> Task: + +def add_task_comment(): + """Adds the comment to the task history""" + log.debug(f"--- add_task_comment() unimplemented!") + # task_comment: TaskCommentDTO) -> TaskDTO: + +def generate_gpx(): + log.debug(f"--- generate_gpx() unimplemented!") + # project_id: int, task_ids_str: str, timestamp=None): + +def generate_osm_xml(): + log.debug(f"--- generate_osm_xml() unimplemented!") + # project_id: int, task_ids_str: str) -> str: + + """Generate xml response suitable for loading into JOSM. A sample output file is in""" +def undo_mapping(): + log.debug(f"--- undo_mapping() unimplemented!") + #project_id: int, task_id: int, user_id: int, preferred_locale: str = "en" + +def map_all_tasks(): + log.debug(f"--- map_all_tasks() unimplemented!") + # project_id: int, user_id: int): + + """Marks all tasks on a project as mapped""" +def reset_all_badimagery(): + log.debug(f"--- reset_all_badimagery() unimplemented!") + # project_id: int, user_id: int): + + """Marks all bad imagery tasks ready for mapping""" +def lock_time_can_be_extended(): + log.debug(f"--- lock_time_can_be_extended() unimplemented!") + # project_id, task_id, user_id): + + # task = Task.get(task_id, project_id) +def extend_task_lock_time(): + log.debug(f"--- extend_task_lock_time() unimplemented!") + #extend_dto: ExtendLockTimeDTO): + + +user = UsersDB('localhost/testdata') +project = ProjectsDB('localhost/testdata') + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("-v", "--verbose", nargs="?", const="0", help="verbose output") + parser.add_argument("-u", "--uri", default='localhost/tm_admin', help="Database URI") + args = parser.parse_args() + # if verbose, dump to the terminal. + log_level = os.getenv("LOG_LEVEL", default="INFO") + if args.verbose is not None: + log_level = logging.DEBUG + + logging.basicConfig( + level=log_level, + # format=("%(asctime)s.%(msecs)03d [%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + format=("[%(levelname)s] " "%(name)s | %(funcName)s:%(lineno)d | %(message)s"), + datefmt="%y-%m-%d %H:%M:%S", + stream=sys.stdout, + ) + + get_task() + get_task_as_dto() + _is_task_undoable() + lock_task_for_mapping() + unlock_task_after_mapping() + stop_mapping_task() + get_task_locked_by_user() + add_task_comment() + generate_gpx() + generate_osm_xml() + undo_mapping() + map_all_tasks() + reset_all_badimagery() + lock_time_can_be_extended() + extend_task_lock_time() diff --git a/tests/test_users.py b/tests/test_users.py index 227ee28b..a698f1b8 100755 --- a/tests/test_users.py +++ b/tests/test_users.py @@ -41,6 +41,9 @@ # FIXME: For now these tests assume you have a local postgres installed. One has the TM # database, the other for tm_admin. + +#UPDATE users SET favorite_projects = ARRAY[1,2,16,5]; + user = UsersDB('localhost/testdata') project = ProjectsDB('localhost/testdata') @@ -70,8 +73,7 @@ def test_role(): log.debug("--- test_role() ---") id = 4606673 role = Userrole(Userrole.ADMIN) - #result = user.updateRole(id, role) - return user.updateColumn(id, {'role': role.name}) + result user.updateColumn(id, {'role': role.name}) assert result def get_mapping_level():