-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some parallel test issues around admin accounts.
- Ensure we don't delete all the admin accounts for tests that run in parallel, since that may impact other tests. - Ensure at least 1 admin account exists prior to some admin routing tests, so the admin doesn't redirect to the screen allowing for admin creation.
- Loading branch information
Showing
2 changed files
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,23 +8,22 @@ class Test::Apis::V1::Admins::TestCreate < Minitest::Test | |
def setup | ||
super | ||
setup_server | ||
Admin.delete_all | ||
end | ||
|
||
def test_downcases_username | ||
attributes = FactoryGirl.build(:admin, :username => "[email protected]").serializable_hash | ||
attributes = FactoryGirl.build(:admin, :username => "HELLO-#{unique_test_id}@example.com").serializable_hash | ||
response = Typhoeus.post("https://127.0.0.1:9081/api-umbrella/v1/admins.json", http_options.deep_merge(admin_token).deep_merge({ | ||
:headers => { "Content-Type" => "application/x-www-form-urlencoded" }, | ||
:body => { :admin => attributes }, | ||
})) | ||
assert_response_code(201, response) | ||
|
||
data = MultiJson.load(response.body) | ||
assert_equal("[email protected]", attributes["username"]) | ||
assert_equal("[email protected]", data["admin"]["username"]) | ||
assert_equal("HELLO-#{unique_test_id}@example.com", attributes["username"]) | ||
assert_equal("hello-#{unique_test_id.downcase}@example.com", data["admin"]["username"]) | ||
|
||
admin = Admin.find(data["admin"]["id"]) | ||
assert_equal("[email protected]", admin.username) | ||
assert_equal("hello-#{unique_test_id.downcase}@example.com", admin.username) | ||
end | ||
|
||
def test_required_validations | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters