def test_query_normal(self, Record): self.dict._get_raw = Mock(return_value=self.raw_html) self.dict.query(self.word, self.timeout) Record.assert_called_with( word=self.word, content=json.dumps(json.loads(self.content)), source='spanish', )
def test_query_normal(self, Record): self.dict._get_raw = Mock(return_value='{"mock": true}') self.dict.query('mock') Record.assert_called_with( word='mock', content='{"mock": true}', source='urban' )
def test_query_normal(self, Record): self.content_json = json.dumps(self.content) self.dict._get_raw = Mock(return_value=self.content_json) self.dict.query('Japanese', timeout=5) Record.assert_called_with( word='Japanese', content=self.content_json, source='jisho', )
def test_query_normal(self, Record): self.dict._get_raw = Mock(return_value=SAMPLE_RESPONSE) self.dict._get_app_key = Mock(return_value=('id', 'key')) self.dict.query('string') Record.assert_called_with(word='string', content=SAMPLE_RESPONSE, source='oxford')
def test_query_normal(self, Record): content = ''' {"en":[{"partOfSpeech":"part_of_speech", "definitions":[{"definition":"definition","examples":["example"]}]}]} ''' self.dict._get_raw = Mock(return_value=content) self.dict.query('mock') r_content = [{"part_of_speech": "part_of_speech", "definitions": [{"definition": "definition", "examples": ["example"]}]}] Record.assert_called_with( word='mock', content=json.dumps(r_content), source='wiktionary' )
def test_query_normal(self, Record): content = ''' {"en":[{"partOfSpeech":"part_of_speech", "definitions":[{"definition":"definition","examples":["example"]}]}]} ''' self.dict._get_raw = Mock(return_value=content) self.dict.query('mock') r_content = [{ "part_of_speech": "part_of_speech", "definitions": [{ "definition": "definition", "examples": ["example"] }] }] Record.assert_called_with(word='mock', content=json.dumps(r_content), source='wiktionary')
def test_query_normal(self, Record): self.dict._get_raw = Mock(return_value='{}') self.dict.query('萌') Record.assert_called_with(word='萌', content='{}', source='moe')
def test_query_normal(self, Record): content = '{"code":200,"lang":"ru-en","text":["house"]}' self.dict._get_raw = Mock(return_value=content) self.dict.query('дом') Record.assert_called_with(word='дом', content=content, source='yandex')
def test_query_normal(self, Record): self.dict._get_raw = Mock(return_value='{"mock": true}') self.dict.query("mock", timeout=666) Record.assert_called_with(word="mock", content='{"mock": true}', source="urban")
def test_query_normal(self, Record): self.dict._get_raw = Mock(return_value='{"mock": true}') self.dict.query('mock') Record.assert_called_with(word='mock', content='{"mock": true}', source='urban')
def test_query_normal(self, Record): self.dict._get_raw = Mock(return_value='{}') self.dict.query('萌', timeout=666) Record.assert_called_with(word='萌', content='{}', source='moe')