diff --git a/test/apis/v1/admins/test_create.rb b/test/apis/v1/admins/test_create.rb index 66c4b7c56..cdfa3fd1a 100644 --- a/test/apis/v1/admins/test_create.rb +++ b/test/apis/v1/admins/test_create.rb @@ -8,11 +8,10 @@ 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 => "HELLO@example.com").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 }, @@ -20,11 +19,11 @@ def test_downcases_username assert_response_code(201, response) data = MultiJson.load(response.body) - assert_equal("HELLO@example.com", attributes["username"]) - assert_equal("hello@example.com", 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("hello@example.com", admin.username) + assert_equal("hello-#{unique_test_id.downcase}@example.com", admin.username) end def test_required_validations diff --git a/test/proxy/routing/test_admin.rb b/test/proxy/routing/test_admin.rb index d549e3b83..efde0a5ee 100644 --- a/test/proxy/routing/test_admin.rb +++ b/test/proxy/routing/test_admin.rb @@ -7,6 +7,7 @@ class Test::Proxy::Routing::TestAdmin < Minitest::Test def setup super setup_server + FactoryGirl.create(:admin) end def test_https_redirect