def insertWebsite(self, url, domain):
		'''增加一个网页,标记为未访问,并对相应的domain增加其入度'''
		cur = self.conn.cursor()
		cur.execute("SELECT 1 FROM Domains WHERE domain=?", (domain,))
		result = cur.fetchone()
		if not result:
			# 未有对应domain记录, 先创建domain, 把入度设为1
			if VERBOSE:
				print 'Spot Domain:',domain
			self.insertDomain(domain, indegree=1)
			cur.execute("SELECT did FROM Domains WHERE domain=?", (domain,))
			did = cur.fetchone()[0]
		else:
			did = result[0]
			# 对应的domain记录已经存在, 对其入度+1
			cur.execute("UPDATE Domains SET outdegree=outdegree+1 WHERE domain=?", (domain,))

		cur.execute("INSERT INTO Websites VALUES (NULL,?,?,NULL,0)", (did, url,))
		# 写入到文件
		self.conn.commit()
def test_convert_html_in_suggestion_change(self):
        html_content = (
            '<p>Value</p><oppia-noninteractive-math raw_latex-with-value="&a'
            'mp;quot;+,-,-,+&amp;quot;"></oppia-noninteractive-math>')
        expected_html_content = (
            '<p>Value</p><oppia-noninteractive-math math_content-with-value='
            '"{&amp;quot;raw_latex&amp;quot;: &amp;quot;+,-,-,+&amp;quot;, &'
            'amp;quot;svg_filename&amp;quot;: &amp;quot;&amp;quot;}"></oppia'
            '-noninteractive-math>')

        change = {
            'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY,
            'property_name': exp_domain.STATE_PROPERTY_CONTENT,
            'state_name': 'Introduction',
            'new_value': {
                'content_id': 'content',
                'html': '<p>suggestion</p>'
            },
            'old_value': {
                'content_id': 'content',
                'html': html_content
            }
        }
        suggestion = suggestion_registry.SuggestionEditStateContent(
            self.suggestion_dict['suggestion_id'],
            self.suggestion_dict['target_id'],
            self.suggestion_dict['target_version_at_submission'],
            self.suggestion_dict['status'], self.author_id,
            self.reviewer_id, change,
            self.suggestion_dict['score_category'],
            self.suggestion_dict['language_code'], False, self.fake_date)

        suggestion.convert_html_in_suggestion_change(
            html_validation_service.
            add_math_content_to_math_rte_components)
        self.assertEqual(
            suggestion.change.old_value['html'], expected_html_content)