Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed Integration tests for 'users' and 'home' controller #74

Merged
merged 19 commits into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
473e2b2
Addes some tests for users profile
sunilkr Jul 7, 2019
b33a315
Adding tp correct branch
sunilkr Jul 7, 2019
4e91742
Merge branch 'master' of https://github.com/null-open-security-commun…
sunilkr Sep 1, 2019
ec902af
Merge branch 'master' of https://github.com/null-open-security-commun…
sunilkr Nov 1, 2019
2df2fe7
Merge branch 'master' of https://github.com/null-open-security-commun…
sunilkr Mar 15, 2020
441831b
Merge branch 'master' of https://github.com/null-open-security-commun…
sunilkr Jul 17, 2020
89681cc
Merge branch 'master' of https://github.com/null-open-security-commun…
sunilkr Dec 24, 2020
f7f1a23
Added 2 tests to users. TODO: password change
sunilkr Dec 27, 2020
43b8cdf
corrected tests
sunilkr Dec 27, 2020
ea1751f
Skipping password change tests as this is handled by devise.
sunilkr Jan 5, 2021
bb3509c
Merge branch 'master' of https://github.com/null-open-security-commun…
sunilkr Jan 9, 2021
39d8213
fix for #66 as suggested by @anantshri
sunilkr Feb 18, 2021
68d7b35
Merge branch 'master' into master
abhisek Feb 18, 2021
9676f1b
changed padding unit to em
sunilkr Feb 18, 2021
277d446
Merge branch 'master' of https://github.com/sunilkr/swachalit
sunilkr Feb 18, 2021
38d7c68
Added notes for Docker Desktop on Windows
sunilkr Mar 14, 2021
0e139d5
Create users_password integration test
sunilkr Mar 14, 2021
be630ec
Completed integration tests for home page
sunilkr Mar 14, 2021
416af56
Merge branch 'master' of https://github.com/null-open-security-commun…
sunilkr Mar 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion doc/developer-guide-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
2. Docker Compose
3. Visual Studio Code

> *Note:* If you are on Windows, you might want to use the [Vagrantfile](https://github.com/null-open-security-community/swachalit/blob/master/Vagrantfile) with [VirtualBox](https://www.virtualbox.org/wiki/Downloads) and [Vagrant](https://www.vagrantup.com/downloads.html). Refer to [Setting up Development Environment with Vagrant](vagrant.md)
### Windows

If you are on Windows but not on latest versions *(1903)* of Windows 10, you need to to use the [Vagrantfile](https://github.com/null-open-security-community/swachalit/blob/master/Vagrantfile) with [VirtualBox](https://www.virtualbox.org/wiki/Downloads) and [Vagrant](https://www.vagrantup.com/downloads.html). Refer to [Setting up Development Environment with Vagrant](vagrant.md).

If you are using relatively latest 64 bit Windows 10 version *(1903 or higher)*, you may consider using [Docker for Desktop](https://docs.docker.com/docker-for-windows/install-windows-home/) with [WSL2 backend](https://docs.microsoft.com/en-us/windows/wsl/install-win10).

## Clone Repository

Expand Down
9 changes: 8 additions & 1 deletion test/fixtures/pages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html

one: {}
one:
id: 1
name: "page-1"
description: 'Test page 1'
navigation_name: 'page1'
content: "This is test page 1"
published: true


two: {}
68 changes: 68 additions & 0 deletions test/integration/home_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
require 'test_helper'

class HomeTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

setup do
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = "1"
sign_in users(:one)
end

teardown do
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = nil
end

test "User visits home page" do
get root_path
assert_response :ok
end

test "User visits upcoming event page" do
get upcoming_path
assert_response :ok
end

test "User visits archives page" do
get archives_path
assert_response :ok
end

test "User visits about page" do
get about_path
assert_response :ok
end

test "User visits calendar page" do
get calendar_path
assert_response :ok
end

test "User visits privacy page" do
get privacy_path
assert_response :ok
end

test "User visits public profile page of existing user" do
get public_profile_path(1)
assert_response :ok
end

test "User visits public profile page of non-existent user" do
assert_raise (ActiveRecord::RecordNotFound) { get public_profile_path(9999) }
end

test "User visits raise excepton page" do
assert_raise { get raise_exception_test_path }
end

test "User visits sessions page" do
get event_sessions_path
assert_response :ok
end

test "User visits forum page" do
get forum_path
assert_response :ok
end

end
43 changes: 43 additions & 0 deletions test/integration/users_password_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
require 'test_helper'

class UsersPasswordTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

setup do
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = "1"
end

teardown do
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = nil
end

test "Unauthenticated user can access passsword recovery page" do
get new_user_password_path
assert_response :ok
end

test "Unauthenticated user can not access edit passsword page" do
get edit_user_password_path
assert_redirected_to new_user_session_path
end

test "Authenticated users should change password from profile page only" do
sign_in users(:one)
get new_user_password_path
assert_redirected_to root_path
end

test "Authenticated users should edit password from profile page only" do
sign_in users(:one)
get edit_user_password_path
assert_redirected_to root_path
end

#TODO: Do we need to test updates on /users/password?
# test "Authenticated users can edit password" do
# sign_in users(:one)
# user = users(:one)
# put user_password_path, user:user
# assert_response :ok
# end
end
44 changes: 0 additions & 44 deletions test/integration/users_test.rb

This file was deleted.