Commit 98d2dd5f9229efc020e2f578398b5bc0866f104d
1 parent
ac400b4a
Exists in
master
and in
1 other branch
Add simple test for points endpoint
Showing
1 changed file
with
8 additions
and
0 deletions
Show diff stats
test/unit/api_test.rb
| @@ -26,6 +26,14 @@ class APITest < ActiveSupport::TestCase | @@ -26,6 +26,14 @@ class APITest < ActiveSupport::TestCase | ||
| 26 | assert_not_nil json['percent'] | 26 | assert_not_nil json['percent'] |
| 27 | end | 27 | end |
| 28 | 28 | ||
| 29 | + should 'get my total pontuation' do | ||
| 30 | + badge = GamificationPlugin::Badge.create!(:owner => environment, :name => 'test_badge') | ||
| 31 | + person.add_badge(badge.id) | ||
| 32 | + get "/api/v1/gamification_plugin/my/points?#{params.to_query}" | ||
| 33 | + json = JSON.parse(last_response.body) | ||
| 34 | + assert_not_nil json['points'] | ||
| 35 | + end | ||
| 36 | + | ||
| 29 | should 'get badges of the public person' do | 37 | should 'get badges of the public person' do |
| 30 | badge = GamificationPlugin::Badge.create!(:owner => environment, :name => 'test_badge') | 38 | badge = GamificationPlugin::Badge.create!(:owner => environment, :name => 'test_badge') |
| 31 | another_person = create(User, :environment => environment).person | 39 | another_person = create(User, :environment => environment).person |