Esempio n. 1
0
 def test_confirm_user(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     signed_user_controller.add_system_admin("name_u1", "1234", "ro", d1,
                                             "0.0.0.5")
     self.assertEqual(
         "SystemAdmin",
         signed_user_controller.confirm_user("name_u1", "1234"))
     self.assertFalse(
         signed_user_controller.confirm_user("name_u1", "12345"))
     self.assertFalse(signed_user_controller.confirm_user(
         "name_u2", "1234"))
import csv
""" This class is the controller that connects the server to the Domain """

users_db = MongoUserDB()
team_db = MongoTeamDB()
policy_db = MongoPolicyDB()
league_db = MongoLeagueDB()
season_db = MongoSeasonDB()
game_db = MongoGameDB()
game_event_db = MongoGameEventDB()
league_controller = LeagueController(league_db, season_db, users_db, policy_db)
signed_user_controller = SignedUserController(users_db)
notification_controller = NotificationController(users_db, game_db)
team_management_controller = TeamManagementController(team_db, users_db)
match_controller = MatchController(game_db, users_db, game_event_db, team_db)
if not signed_user_controller.confirm_user('dor', '1234'):
    signed_user_controller.add_system_admin('dor', '1234', 'dor',
                                            date.datetime(1994, 1, 20))

try:
    signed_user_controller.add_team_owner('shahar', '1234', 'shahar',
                                          date.datetime(1993, 1, 1))
    signed_user_controller.add_referee(RefereeQualificationEnum.MAIN, 'oscar',
                                       '1234', 'oscar',
                                       date.datetime(1994, 11, 9))
    main_referee = signed_user_controller.get_user_by_name('oscar')
    owner = signed_user_controller.get_user_by_name('shahar')

    team_management_controller.open_new_team('Brca', owner.user_id)
    team_management_controller.open_new_team('Real', owner.user_id)