Ejemplo n.º 1
0
 def score_up(self):
     api = HabiticaApi(self.owner.habitica.user_id, self.owner.habitica.api_token)
     result = api.post_task(self.habit_id)
     self.tasks_completed += 1
     self.last_upscored = timezone.now()
     self.save()
     return result
Ejemplo n.º 2
0
 def score_up(self):
     api = HabiticaApi(self.owner.habitica.user_id,
                       self.owner.habitica.api_token)
     self.tasks_completed += 1
     self.last_upscored = timezone.now()
     self.save()
     return api.post_task(self.habit)
Ejemplo n.º 3
0
def test_get_user_details_google(mock_habitica_api_google):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    user_details = api.get_user_details()
    assert default.JSON_ID in user_details
    assert default.JSON_NAME in user_details
    assert user_details[default.JSON_NAME] == utils.GOOGLE_NAME
    assert default.JSON_EMAIL in user_details
    assert user_details[default.JSON_EMAIL] == utils.USER_EMAIL
Ejemplo n.º 4
0
def test_get_user_details_facebook(mock_habitica_api_facebook):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    user_details = api.get_user_details()
    assert default.JSON_ID in user_details
    assert default.JSON_NAME in user_details
    assert user_details[default.JSON_NAME] == utils.FACEBOOK_NAME
    assert default.JSON_EMAIL in user_details
    assert user_details[default.JSON_EMAIL] == utils.USER_EMAIL
Ejemplo n.º 5
0
def test_post_task(mock_habitica_api):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    response = api.post_task(task_id='test_id')
    assert default.JSON_DELTA in response
Ejemplo n.º 6
0
def test_auth_test(mock_habitica_api):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    auth_status = api.test_auth()
    assert auth_status is True
Ejemplo n.º 7
0
def test_get_user_details_invalid_provider(mock_habitica_api_invalid_provider):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    user_details = api.get_user_details()
    assert default.JSON_ID in user_details
    assert default.JSON_NAME not in user_details
    assert default.JSON_EMAIL not in user_details
Ejemplo n.º 8
0
def test_get_user_details_facebook(mock_habitica_api_facebook):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    user_details = api.get_user_details()
    assert default.JSON_ID in user_details
    assert default.JSON_NAME in user_details
    assert user_details[default.JSON_NAME] == utils.FACEBOOK_NAME
Ejemplo n.º 9
0
def test_server_status(mock_habitica_api):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    status = api.get_status()
    assert status is True
Ejemplo n.º 10
0
def test_post_task(mock_habitica_api):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    response = api.post_task(task_id='test_id')
    assert default.JSON_DELTA in response
Ejemplo n.º 11
0
def test_auth_test(mock_habitica_api):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    auth_status = api.test_auth()
    assert auth_status is True
Ejemplo n.º 12
0
def test_server_status(mock_habitica_api):
    api = HabiticaApi(user_id=-1, api_token='uses_mok')
    status = api.get_status()
    assert status is True