Let $\Omega$ be an open, bounded domain, and a smooth internal boundary $\Gamma$ divides $\Omega$ into two open and connected sets, $\Omega1$ and $\Omega2$, where $\Omega1$ is strictly included in $\Omega$, which means that $\partial\Omega=\partial\Omega2$ and $\partial\Omega\cap\Gamma=\emptyset$.
consider the following boundary value problem: $$\Delta u_1=0 ~~in ~~\Omega1$$ $$\Delta u_2=0 ~~in ~~\Omega2$$ $$u_2=d ~~on ~~\partial \Omega$$ $$u_2-u_1=g_1~~ on ~~\Gamma$$ $$\frac{\partial u_2}{\partial n}-\frac{\partial u_1}{\partial n}=g_2~~ on ~~\Gamma$$.
I want to find the weak form of this problem when the test space is $H^1(\Omega).$ Is it true?
Find $u \in H^1(\Omega)$
$$-\int_{\Omega1}\nabla u.\nabla v\Omega1-\int_{\Omega2}\nabla u.\nabla vd\Omega2+\int_{\partial\Omega}\frac{\partial u_2}{\partial n}vds+\int_{\Gamma}g_2v ds=0.$$ How should I use other bounadary conditions?
Your definition of a weak solution is incorrect. By definition, given any classical BVP, to be correct a definition of a weak solution should meet the following criterion: every classical solution is a weak solution, while every weak solution is necessarily a classical solution whenever it be found classically smooth. For a BVP, the correct definition of a weak solution must not be mismatched with the correct setting of the BVP in a weak formulation. In your case, the correct definition of a weak solution looks something like this. Find $u\in L^2(\Omega)$ with $u\in H^1(\Omega_j),\;j=1,2$, satisfying boundary and transmission conditions $$ u|_{\partial\Omega}=d,\quad u|_{\Gamma_2}-u|_{\Gamma_1}=g_1, \quad (\Gamma_j\overset{\rm def}=\Gamma\cap\partial\Omega_j\,, \;j=1,2), $$ in conjunction with the integral identity $$ -\int\limits_{\Omega_1}\nabla u\cdot\nabla v\,dx-\int\limits_{\Omega_2}\nabla u\cdot\nabla v\,dx=\int\limits_{\Gamma}g_2v\,ds+\int\limits_{\Omega_1}f_1v\,dx +\int\limits_{\Omega_2}f_2v\,dx\quad\forall\,v\in H^1_0(\Omega),\tag{$\ast$} $$ where the unit normal $n$ to $\Gamma$ in your classical formulation is supposed to be outward w.r.t. $\Omega_1\,$.
Remark. If need be, you can follow the above advice by Hui Zhang, which amounts to finding $\widetilde{u}\in H^1_0(\Omega)$ satisfying the integral identity $$ -\int\limits_{\Omega}\nabla\widetilde{u} \cdot\nabla v\,dx=\int\limits_{\Gamma}g_2v\,ds-\int\limits_{\Omega_2}\nabla w\cdot\nabla v\,dx+\int\limits_{\Omega_1}f_1v\,dx +\int\limits_{\Omega_2}f_2v\,dx\quad\forall\,v\in H^1_0(\Omega), $$ where $w\in H^2(\Omega_2)$ might be any given function satisfying boundary conditions $$ w|_{\Gamma}=g_1\,,\quad w|_{\partial\Omega}=d,\quad \frac{\partial w}{\partial n}\Bigr|_{\Gamma}=0. $$ In this case, solution of your problem can be written in the form $$ u(x)= \begin{cases} \widetilde{u}(x),\quad x\in \Omega_1\,,\\ \widetilde{u}(x)+w(x),\quad x\in \Omega_2. \end{cases} $$ This is one of the many approaches to solving your proble in the correct weak formulation $(\ast)$.