]> git.openstreetmap.org Git - rails.git/blob - test/models/oauth_nonce_test.rb
Add support for Facebook authentication
[rails.git] / test / models / oauth_nonce_test.rb
1 require "test_helper"
2
3 class OauthNonceTest < ActiveSupport::TestCase
4   api_fixtures
5
6   ##
7   # the nonce has only one property, that it is a unique pair of
8   # string and timestamp.
9   def test_nonce_uniqueness
10     string = "0123456789ABCDEF"
11     timestamp = Time.now
12
13     nonce1 = OauthNonce.remember(string, timestamp)
14     assert_not_equal false, nonce1, "First nonce should be unique. Check your test database is empty."
15
16     nonce2 = OauthNonce.remember(string, timestamp)
17     assert_equal false, nonce2, "Shouldn't be able to remember the same nonce twice."
18   end
19 end