     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
 

      assert user.username == @valid_attrs.username
    end

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

      assert user.email == @update_attrs.email
      assert user.name == @update_attrs.name
      assert user.username == @update_attrs.username
    end

    test "update_user/2 not updates current_user rights if user is not admin" do
      user = user_fixture()
      assert {:ok, user} = Accounts.update_user(user, %{is_staff: true, is_superuser: true}, user)
      assert %User{} = user
      assert user.is_staff == false
      assert user.is_superuser == false
    end

    test "update_user/2 updates current_user rights if user is admin" do
      user = user_fixture()
      admin = Accounts.get_user_by_username("admin")
      assert {:ok, user} = Accounts.update_user(user, %{is_staff: true, is_superuser: true}, admin)
      assert %User{} = user
      assert user.is_staff == true
      assert user.is_superuser == true
    end

    test "update_user/2 with invalid data returns error changeset" do
