     test "get_user_by_username/1 returns the user with given username" do
       user = user_fixture()
       user2 = Accounts.get_user_by_username(user.username)
+      is_the_same_users(user, user2)
+    end
+
+    test "get_user_by_username/1 returns the user with given username but different case" do
+      user = user_fixture()
+      user2 = Accounts.get_user_by_username("UsErNaMe")
       is_the_same_users(user, user2)
     end
 

    @valid_attrs %{name: "Test Name", email: "test@test.com", password: "password", username: "username"}
    @update_attrs %{name: "Updated Name", email: "test_update@test.com", password: "updated_password", username: "testusername_updated"}
    @invalid_attrs %{name: nil, email: nil, password_hash: nil, username: nil}

    def user_fixture(attrs \\ %{}) do
      {:ok, user} =

      assert user.username == @valid_attrs.username
    end

    test "create_user/1 with valid data and username has already been taken returns error changeset" do
      assert {:ok, %User{} = user} = Accounts.create_user(@valid_attrs)
      assert user.name == @valid_attrs.name
      assert user.email == @valid_attrs.email
      assert user.username == @valid_attrs.username

      assert {:error, :already_taken_username} = Accounts.create_user(@valid_attrs2)
    end

    test "create_user/1 with valid data and email has already been taken returns error changeset" do
      assert {:ok, %User{} = user} = Accounts.create_user(@valid_attrs)
      assert user.name == @valid_attrs.name
      assert user.email == @valid_attrs.email
      assert user.username == @valid_attrs.username

      assert {:error, :already_taken_email} = Accounts.create_user(@valid_attrs3)
    end

    test "create_user/1 with invalid data returns error changeset" do
      assert {:error, %Ecto.Changeset{}} = Accounts.create_user(@invalid_attrs)
    end
