Definition: two smooth maps $f,g:M\rightarrow N$ are smoothly homotopic if it exists $H:M\times\mathbb R\rightarrow N$ smooth such as $H(\cdot,t)=f$ for $t\le 0$, and $H(\cdot,t)=g$ for $t\ge 1$.
Theorem: if $f,g:M\rightarrow N$ are smoothly homotopic then their pullback are equal in de Rham cohomology (ie $f^*=g^*:H^*(N)\rightarrow H^*(M)$).
For a proof of this theorem, look at, for example, Bott&Tu
Lemma 1: if $f:M\rightarrow N$ is continuous then $f$ is (continuously) homotopic to a smooth map.
Lemma 2: if two smooth maps $f,g:M\rightarrow N$ are continuously homotopic then they are smoothly homotopic.
To prove these lemmas, you can embed your manifolds in $\mathbb R^n$ spaces. If I remember well, it's done in From Calculus to Cohomology by Ib Henning Madsen and Jørgen Tornehave.
We can start having fun:
Theorem: a continuous map $f:M\rightarrow N$ induces a pullback $f^*:H^*(N)\rightarrow H^*(M)$ in the de Rham cohomology.
Proof: by lemma 1, it exists $f'$ smooth which is continuously homotopic to $f$, and let $f^*=f'^*$. We have to check that $f^*$ is well defined : if $f''$ is another smooth map continuously homotopic to $f$, then $f'$ and $f''$ are continuously homotopic, and so, by lemma 2, smoothly homotopic, so $f'^*=f''^*$ by the theorem. $\blacksquare$
Corollary 1: if $f:M\rightarrow N$ and $g:N\rightarrow L$ are continuous between manifolds then $(g\circ f)^*=f^*\circ g^*$.
Corollary 2: if $f,g:M\rightarrow N$ are continuously homotopic then $f^*=g^*$.
Corollary 3: two manifolds with the same homotopy type have the same de Rham cohomology.
In particular, two homeomorphic manifolds have the same de Rham cohomology.
Remark: this result seems impressive to me, because it shows that the de Rham cohomology on a manifold doesn't depend on the differential structure.
$H_0(X) = \mathbb{Z}$ since it's connected.
$H_2(X) = \mathbb{Z}^2$ since there are two non-contractable spheres
$H_1(X) = \mathbb{Z}$ since the torus has two non-contractible curves, but now one can be contracted along the sphere.
Let $a$ be the torus, and $b\cup b' = S^2$ be the upper and lower hemispheres.
$\partial a = a_1 + a_2 - a_1 - a_2 = 0$
Let $a_1 = \mathbb{T}^2 \cap S^2$ be the meridian of the sphere (as well as the torus)
$\partial b = a_1 =\partial b'$
Let $a_{12}$ be a point of $a_1 =\mathrm{torus}\cap \mathrm{sphere}$:
$\partial a_1 = \partial a_2 = \partial b_1 =a_{12} - a_{12}=0$
$H_0 = \ker\partial / \mathrm{im} \,\partial = \mathrm{span}\langle a_{12}\rangle = \mathbb{Z}$
$H_1 = \ker\partial / \mathrm{im} \,\partial = \mathrm{span}\langle a_1, a_2\rangle /
\mathrm{span}\langle a_1\rangle = \mathbb{Z}$
$H_2 = \ker\partial = \mathrm{span}\langle a,b-b'\rangle = \mathbb{Z}^2$
You may also observe the meridian circle $\mathrm{sphere} \cap \mathrm{torus}$ is contractible to a point.
In Hatcher Chapter 0, example 0.8 (page 12) shows us the sphere with two points identified is the homotopy equivalent to the wedge of a sphere and a circle.
$$ S^2 \simeq S^2 \vee S^1$$
For your example, $ \mathbb{T}^2 \cup_{S^1} S^2 \simeq S^2 \vee S^2 \vee S^1$.
Their homology groups will also be the same. $H_0 = \mathbb{Z}, H_1 = \mathbb{Z}, H_2 = \mathbb{Z}^2$.
Best Answer
We cut $T^{3}$ into two parts, each part is homotopic to a torus. One visualize this by considering $T^{3}=T^{2}\times \mathbb{S}^{1}$, and the two parts are $\mathbb{T}^{2}\times I$ respectively, with the $I$ coming out of considering $\mathbb{S}^{1}$ as gluing two intervals together. The intersection of the two parts is again homotopic to the torus. Nowe we have:
$$\rightarrow H^{2}(X)\rightarrow H^{2}(\mathbb{T}^{2}\times I)\oplus H^{2}(\mathbb{T}^{2}\times I)\rightarrow H^{2}(\mathbb{T}^{2}\times I)\rightarrow H^{3}(X)\rightarrow0$$
We know $H^{2}(\mathbb{T}^{2})=\mathbb{R}^{1}$ via induction. So we have
$$H^{0}(X)\rightarrow \mathbb{R}^{2}\rightarrow \mathbb{R}\rightarrow H^{1}(X)\rightarrow \mathbb{R}^{4}\rightarrow \mathbb{R}^{2}\rightarrow H^{2}(X)\rightarrow \mathbb{R}^{2}\rightarrow \mathbb{R}\rightarrow \mathbb{R}\rightarrow0$$
This gives $H^{2}(X)=\mathbb{R}^{3}$ because last map is an isomorphism and the map $H^{1}(\mathbb{T}^{2}\times I)\rightarrow H^{2}(X)$ has a one dimensional image. Consider a closed one-form $w$ on $\mathbb{T}^{2}$, if we use partition of unity to split it into two parts, then no matter which choice we use we would end up with the same class in $H^{2}(X)$ if one thinks geometrically. This together with the first part gives us $H^{1}(X)=\mathbb{R}^{3}$, $H^{2}(X)=\mathbb{R}^{3}$.