diff options
author | jessib <jessib@riseup.net> | 2013-12-02 11:56:04 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-12-02 11:56:04 -0800 |
commit | 2a2ffd46bf4e6009f2957fb4e4abdedbfa7e3245 (patch) | |
tree | 41dd790266aaa951dfa35889527f78015f8c4451 /users/test/functional | |
parent | 8e9b65b01bbd9d44d4077d94f2dc4ac375cf8e85 (diff) | |
parent | 8de6f143e53af5287b41913dcf3c7969f452fbc9 (diff) |
Merge branch 'develop' into feature/service_level
Diffstat (limited to 'users/test/functional')
-rw-r--r-- | users/test/functional/keys_controller_test.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/users/test/functional/keys_controller_test.rb b/users/test/functional/keys_controller_test.rb new file mode 100644 index 0000000..b69cbc0 --- /dev/null +++ b/users/test/functional/keys_controller_test.rb @@ -0,0 +1,32 @@ +require 'test_helper' + +class KeysControllerTest < ActionController::TestCase + + test "get existing public key" do + public_key = 'my public key' + @user = stub_record :user, :public_key => public_key + User.stubs(:find_by_login).with(@user.login).returns(@user) + get :show, :login => @user.login + assert_response :success + assert_equal "text/html", response.content_type + assert_equal public_key, response.body + end + + test "get non-existing public key for user" do + # this isn't a scenerio that should generally occur. + @user = stub_record :user + User.stubs(:find_by_login).with(@user.login).returns(@user) + get :show, :login => @user.login + assert_response :success + assert_equal "text/html", response.content_type + assert_equal '', response.body.strip + end + + test "get public key for non-existing user" do + # raise 404 error if user doesn't exist (doesn't need to be this routing error, but seems fine to assume for now): + assert_raise(ActionController::RoutingError) { + get :show, :login => 'asdkljslksjfdlskfj' + } + end + +end |