예제 #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)