예제 #1
0
 def test_use_unofficial(self):
     self.set_config_values(
         setting={
             'server_host': 'example.com',
             'server_port': 8042,
             'use_server_for_submission': True,
         })
     self.assertEqual('http://example.com:8042', build_submission_url())
     self.assertEqual('http://example.com:8042/', build_submission_url('/'))
     self.assertEqual(
         'http://example.com:8042/some/path?foo=1&bar=baz',
         build_submission_url('/some/path', {
             'foo': 1,
             'bar': 'baz'
         }))
예제 #2
0
 def test_unofficial_fallback(self):
     self.set_config_values(
         setting={
             'server_host': 'test.musicbrainz.org',
             'server_port': 80,
             'use_server_for_submission': False,
         })
     self.assertEqual('https://musicbrainz.org:443', build_submission_url())
     self.assertEqual('https://musicbrainz.org:443/',
                      build_submission_url('/'))
     self.assertEqual(
         'https://musicbrainz.org:443/some/path?foo=1&bar=baz',
         build_submission_url('/some/path', {
             'foo': 1,
             'bar': 'baz'
         }))
예제 #3
0
파일: addrelease.py 프로젝트: ruipin/picard
def _get_form(title, action, label, form_data):
    return _form_template.format(
        title=htmlescape(title),
        submit_label=htmlescape(label),
        action=htmlescape(build_submission_url(action)),
        form_data=_format_form_data(form_data),
    )
예제 #4
0
 def test_official(self):
     for host in MUSICBRAINZ_SERVERS:
         self.set_config_values(
             setting={
                 'server_host': host,
                 'server_port': 80,
                 'use_server_for_submission': False,
             })
         self.assertEqual('https://%s:443' % host, build_submission_url())
         self.assertEqual('https://%s:443/' % host,
                          build_submission_url('/'))
         self.assertEqual(
             'https://%s:443/some/path?foo=1&bar=baz' % host,
             build_submission_url('/some/path', {
                 'foo': 1,
                 'bar': 'baz'
             }))
예제 #5
0
파일: disc.py 프로젝트: ruipin/picard
 def submission_url(self):
     if self.id:
         return build_submission_url('/cdtoc/attach',
                                     query_args={
                                         'id':
                                         self.id,
                                         'tracks':
                                         self.tracks,
                                         'toc':
                                         self.toc_string.replace(' ', '+'),
                                     })
     else:
         return None