diff --git a/CHANGES.txt b/CHANGES.txt index b5797d5..24828fe 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +0.2.2 + * Fix several test cases + 0.2.1 * Fix of PyPI packaging diff --git a/gengine/__init__.py b/gengine/__init__.py index 165bf1a..bd579d4 100644 --- a/gengine/__init__.py +++ b/gengine/__init__.py @@ -5,7 +5,7 @@ from gengine.base.errors import APIError from gengine.base.settings import set_settings -__version__ = '0.2.1' +__version__ = '0.2.2' import datetime diff --git a/gengine/app/tests/test_achievement1.py b/gengine/app/tests/test_achievement1.py index 4703a95..b42131c 100644 --- a/gengine/app/tests/test_achievement1.py +++ b/gengine/app/tests/test_achievement1.py @@ -262,10 +262,10 @@ def test_evaluate_achievement_for_participate(self): level = Achievement.evaluate(user, achievement.id, achievement_date).get("level") - Value.increase_value(variable_name="participate", user=user, value=1, key="7") + Value.increase_value(variable_name="participate", user=user, value=1, key="7", at_datetime=achievement_date) level2 = Achievement.evaluate(user, achievement.id, achievement_date).get("level") - Value.increase_value(variable_name="participate", user=user, value=5, key="5") + Value.increase_value(variable_name="participate", user=user, value=5, key="5", at_datetime=achievement_date) level1 = Achievement.evaluate(user, achievement.id, achievement_date).get("level") self.assertEqual(level, 1) @@ -284,7 +284,7 @@ def test_evaluate_achievement_for_invite_users(self): update_connection().execute(t_values.delete()) create_variable("invite_users", variable_group="day") - Value.increase_value(variable_name="invite_users", user=user, value=1, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=1, key=None, at_datetime=achievement_date) create_goals(achievement, goal_goal="1*level", @@ -296,11 +296,11 @@ def test_evaluate_achievement_for_invite_users(self): level = Achievement.evaluate(user, achievement.id, achievement_date).get("level") print("level: ", level) - Value.increase_value(variable_name="invite_users", user=user, value=8, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=8, key=None, at_datetime=achievement_date) level1 = Achievement.evaluate(user, achievement.id, achievement_date).get("level") print("level1 ", level1) - Value.increase_value(variable_name="invite_users", user=user, value=5, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=5, key=None, at_datetime=achievement_date) level2 = Achievement.evaluate(user, achievement.id, achievement_date).get("level") print("level2: ", level2) @@ -334,7 +334,7 @@ def test_get_reward_and_properties_for_achievement(self): create_achievement_user(user=user, achievement=achievement, achievement_date=achievement_date, level=1) create_variable("invite_users", "none") - Value.increase_value(variable_name="invite_users", user=user, value=4, key="5") + Value.increase_value(variable_name="invite_users", user=user, value=4, key="5", at_datetime=achievement_date) create_goals(achievement = achievement, goal_condition="""{"term": {"type": "literal", "variable": "invite_users"}}""", @@ -380,16 +380,16 @@ def test_multiple_goals_of_same_achievement(self): variable1 = create_variable("participate_seminar", variable_group=None) variable2 = create_variable("participate_talk", variable_group=None) - Value.increase_value(variable1.name, user, "2", "5") - Value.increase_value(variable1.name, user, "3", "7") - Value.increase_value(variable2.name, user, "3", key=None) + Value.increase_value(variable1.name, user, "2", "5", at_datetime=achievement_date) + Value.increase_value(variable1.name, user, "3", "7", at_datetime=achievement_date) + Value.increase_value(variable2.name, user, "3", key=None, at_datetime=achievement_date) result = Achievement.evaluate(user, achievement.id, achievement_date) print("multiple_goals_of_same_achievement:",result) - Value.increase_value(variable1.name, user, "2", "7") + Value.increase_value(variable1.name, user, "2", "7", at_datetime=achievement_date) result1 = Achievement.evaluate(user, achievement.id, achievement_date) print(result1) - Value.increase_value(variable2.name, user, "2", key=None) + Value.increase_value(variable2.name, user, "2", key=None, at_datetime=achievement_date) result2 = Achievement.evaluate(user, achievement.id, achievement_date) print(result2) diff --git a/gengine/app/tests/test_achievement_integration_tests.py b/gengine/app/tests/test_achievement_integration_tests.py index d03d0f4..5a3ba93 100644 --- a/gengine/app/tests/test_achievement_integration_tests.py +++ b/gengine/app/tests/test_achievement_integration_tests.py @@ -35,7 +35,7 @@ def test_evaluate_achievement_for_weekly_evaluation_case1(self): # User has achieved in first week and 2nd week print("Weekly evaluation Case 1") - Value.increase_value(variable_name="invite_users", user=user, value=10, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=10, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print(achievement_result) @@ -81,7 +81,7 @@ def test_evaluate_achievement_for_weekly_evaluation_case2(self): # User has not achieved in first week but in 2nd week print("Weekly evaluation Case 2") - Value.increase_value(variable_name="invite_users", user=user, value=5, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=5, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print(achievement_result) @@ -123,7 +123,7 @@ def test_evaluate_achievement_for_weekly_evaluation_case3(self): # User has not achieved in first week and achieved after few days in a same week print("Weekly evaluation Case 3") - Value.increase_value(variable_name="invite_users", user=user, value=5, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=5, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print(achievement_result) @@ -168,7 +168,7 @@ def test_evaluate_achievement_for_monthly_evaluation_case1(self): # User has achieved in this month and next month print("Monthly evaluation Case 1") - Value.increase_value(variable_name="invite_users", user=user, value=10, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=10, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print("achievement result: ", achievement_result) @@ -217,7 +217,7 @@ def test_evaluate_achievement_for_monthly_evaluation_case2(self): # User has NOT achieved in this month but in the next month print("Monthly evaluation Case 2") - Value.increase_value(variable_name="invite_users", user=user, value=5, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=5, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print("achievement result: ", achievement_result) @@ -262,7 +262,7 @@ def test_evaluate_achievement_for_monthly_evaluation_case3(self): # Not achieved in first month after some days in the same month print("Monthly evaluation Case 3") - Value.increase_value(variable_name="invite_users", user=user, value=5, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=5, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print("achievement result: ", achievement_result) @@ -307,7 +307,7 @@ def test_evaluate_achievement_for_yearly_evaluation_case1(self): # Goal achieved in both this month and next year print("Yearly evaluation Case 1") - Value.increase_value(variable_name="invite_users", user=user, value=10, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=10, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print("achievement result: ", achievement_result) @@ -356,7 +356,7 @@ def test_evaluate_achievement_for_yearly_evaluation_case2(self): # Not achieved in first year but in the second year print("Yearly evaluation Case 2") - Value.increase_value(variable_name="invite_users", user=user, value=5, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=5, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print("achievement result: ", achievement_result) @@ -403,7 +403,7 @@ def test_evaluate_achievement_for_yearly_evaluation_case3(self): # Not achieved in first month after some days in the same year print("Yearly evaluation Case 3") - Value.increase_value(variable_name="invite_users", user=user, value=5, key=None) + Value.increase_value(variable_name="invite_users", user=user, value=5, key=None, at_datetime=achievement_date) achievement_result = Achievement.evaluate(user, achievement.id, achievement_date) print("achievement result: ", achievement_result) diff --git a/gengine/app/tests/test_eval_types_and_rewards.py b/gengine/app/tests/test_eval_types_and_rewards.py index 2d338bc..f888063 100644 --- a/gengine/app/tests/test_eval_types_and_rewards.py +++ b/gengine/app/tests/test_eval_types_and_rewards.py @@ -77,10 +77,10 @@ def test_friends_leaderboard(self): goal_group_by_key=False ) - Value.increase_value(variable_name="invite_users", user=user1, value=12, key=None) - Value.increase_value(variable_name="invite_users", user=user2, value=2, key=None) - Value.increase_value(variable_name="invite_users", user=user3, value=11, key=None) - Value.increase_value(variable_name="invite_users", user=user4, value=6, key=None) + Value.increase_value(variable_name="invite_users", user=user1, value=12, key=None, at_datetime=achievement_date1) + Value.increase_value(variable_name="invite_users", user=user2, value=2, key=None, at_datetime=achievement_date1) + Value.increase_value(variable_name="invite_users", user=user3, value=11, key=None, at_datetime=achievement_date1) + Value.increase_value(variable_name="invite_users", user=user4, value=6, key=None, at_datetime=achievement_date1) clear_all_caches()