Пример #1
0
 def get_test_account(self):
     account = None
     try:
         account_name = self.test_data["TEST_ACCOUNT_NAME"]
         account = Account.objects(name=account_name).first()
         if account is None:
             account = Account(name=account_name, id=self.test_data["TEST_ACCOUNT_ID"] )
             account.save()
     except:
         pass
     return account
Пример #2
0
 def test_can_create_and_delete_account(self):
     Account.objects(name="Los Pollos Hermanos").delete()
     account = Account(name="Los Pollos Hermanos")
     account.save()
     account2 = Account.objects(id=account.id).first()
     assert(account2.name == account.name)
     Account.objects(id=account.id).delete()
Пример #3
0
 def test_can_create_and_delete_account(self):
     id = ObjectId("TempTempTemp")
     account = Account(id=id, name="Los Pollos Hermanos")
     account.save()
     account2 = Account.objects(id=account.id).first()
     assert (account2.name == account.name)
     Account.objects(id=account.id).delete()
Пример #4
0
    def test_can_get_users(self):
        account = Account.objects(name="Goalboost").first()
        users = account.get_users()
        #print(len(users))
        goalboost_timers = TimerDAO().get_timers_for_users(users, tag_list=["Goalboost"])
        assert(len(goalboost_timers) >  0)
        assert(type(goalboost_timers[0] == type(Timer())))
        print(len(goalboost_timers))

        all_timers = TimerDAO().get_timers_for_users(users)
        assert(len(all_timers) > len(goalboost_timers))
Пример #5
0
 def test_can_call_get_users_on_unsaved_account(self):
     Account.objects(name="Los Pollos Hermanos").delete()
     account = Account(name="Los Pollos Hermanos")
     users_for_account = account.get_users()
     assert(users_for_account is not None)
     assert(len(users_for_account) == 0)
Пример #6
0
def project_hours():
    timerDao = TimerDAO()
    account = Account.objects(name="Goalboost").first()
    users = [user.id for user in account.get_users()]
    timer_stats = timerDao.get_weekly_timer_statistics(users, ["Goalboost"])
    return render_template("timer/project_hours.html", stats = timer_stats)
Пример #7
0
 def test_can_get_timer_stats_by_week(self):
     account = Account.objects(name="Goalboost").first()
     users = [user.id for user in account.get_users()]
     goalboost_stats = TimerDAO().get_weekly_timer_statistics(users, ["Goalboost"])
     assert(len(goalboost_stats) > 5)