Exemple #1
0
def test_get_meta_data_correct():
    with open(os.path.join(RESOURCES, 'correct_meta_data_example.json')) as f:
        r = json.load(f)
    with patch.object(pp.delayed_requester,
                      'get_response_json',
                      return_value=r):
        actual_meta_data = pp._get_meta_data(
            'e9df48fe-68ea-419e-b9df-441e0b208335')
        expect_meta_data = [
            'http://phylopic.org/assets/images/submissions/e9df48fe-68ea-419e-b9df-441e0b208335.1024.png',
            'http://phylopic.org/image/e9df48fe-68ea-419e-b9df-441e0b208335',
            'http://phylopic.org/assets/images/submissions/e9df48fe-68ea-419e-b9df-441e0b208335.1024.png',
            '', '847', '1024',
            'http://creativecommons.org/publicdomain/zero/1.0/',
            'Jonathan Wells',
            'Chondrus crispus NODC Taxonomic Code, database (version 8.0) 1996',
            {
                'taxa': [
                    'Chondrus crispus NODC Taxonomic Code, database (version 8.0) 1996'
                ],
                'credit_line':
                'Jonathan Wells',
                'pub_date':
                '2020-02-26 11:59:53'
            }
        ]
        assert actual_meta_data == expect_meta_data
Exemple #2
0
def test_get_meta_data_with_no_img_url():
    with open(os.path.join(RESOURCES, 'no_image_url_example.json')) as f:
        r = json.load(f)
    with patch.object(pp.delayed_requester,
                      'get_response_json',
                      return_value=r):
        meta_data = pp._get_meta_data('')
        assert meta_data is None
Exemple #3
0
def test_get_meta_data_for_none_response():
    with patch.object(pp.delayed_requester,
                      'get_response_json',
                      return_value=None):
        meta_data = pp._get_meta_data('')
        assert meta_data is None