Exemplo n.º 1
0
 def test_repoweb(self):
     self.unit.translation.subproject.repoweb = (
         'http://example.net/%(file)s#L%(line)s')
     self.unit.location = 'foo.bar:123'
     self.assertEqual(
         get_location_links(self.unit),
         '<a href="http://example.net/foo.bar#L123">foo.bar:123</a>')
Exemplo n.º 2
0
 def test_repowebs(self):
     self.unit.translation.subproject.repoweb = "http://example.net/%(file)s#L%(line)s"
     self.unit.location = "foo.bar:123,bar.foo:321"
     self.assertEqual(
         get_location_links(self.unit),
         '<a href="http://example.net/foo.bar#L123">foo.bar:123</a>\n'
         '<a href="http://example.net/bar.foo#L321">bar.foo:321</a>',
     )
Exemplo n.º 3
0
 def test_repowebs(self):
     self.unit.translation.subproject.repoweb = (
         'http://example.net/%(file)s#L%(line)s')
     self.unit.location = 'foo.bar:123,bar.foo:321'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         '<a href="http://example.net/foo.bar#L123">foo.bar:123</a>\n'
         '<a href="http://example.net/bar.foo#L321">bar.foo:321</a>')
Exemplo n.º 4
0
 def test_user_url(self):
     self.unit.translation.subproject.repoweb = (
         'http://example.net/%(file)s#L%(line)s')
     self.profile.editor_link = 'editor://open/?file=%(file)s&line=%(line)s'
     self.unit.location = 'foo.bar:123'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         '<a href="editor://open/?file=foo.bar&amp;line=123">'
         'foo.bar:123</a>')
Exemplo n.º 5
0
 def test_repoweb(self):
     self.unit.translation.subproject.repoweb = (
         'http://example.net/%(file)s#L%(line)s'
     )
     self.unit.location = 'foo.bar:123'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         '<a href="http://example.net/foo.bar#L123">foo.bar:123</a>'
     )
Exemplo n.º 6
0
 def test_user_url(self):
     self.unit.translation.subproject.repoweb = (
         'http://example.net/%(file)s#L%(line)s'
     )
     self.profile.editor_link = 'editor://open/?file=%(file)s&line=%(line)s'
     self.unit.location = 'foo.bar:123'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         '<a href="editor://open/?file=foo.bar&amp;line=123">'
         'foo.bar:123</a>'
     )
Exemplo n.º 7
0
 def test_repoweb(self):
     self.unit.translation.subproject.repoweb = (
         'http://example.net/%(file)s#L%(line)s')
     self.unit.location = 'foo.bar:123'
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit), '''
         <a href="http://example.net/foo.bar#L123" target="_blank">
         foo.bar:123
         <i class="fa fa-external-link"></i>
         </a>
         ''')
Exemplo n.º 8
0
 def test_user_url(self):
     self.unit.translation.subproject.repoweb = (
         'http://example.net/%(file)s#L%(line)s')
     self.profile.editor_link = 'editor://open/?file=%(file)s&line=%(line)s'
     self.unit.location = 'foo.bar:123'
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit), '''
         <a href="editor://open/?file=foo.bar&amp;line=123" target="_blank">
         foo.bar:123
         <i class="fa fa-external-link"></i>
         </a>
         ''')
Exemplo n.º 9
0
 def test_repoweb(self):
     self.unit.translation.component.repoweb = (
         'http://example.net/{{filename}}#L{{line}}')
     self.unit.location = 'foo.bar:123'
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit), '''
         <a class="long-filename"
             href="http://example.net/foo.bar#L123" target="_blank"
             rel="noopener noreferrer">
         foo.bar:123
         </a>
         ''')
Exemplo n.º 10
0
 def test_user_url(self):
     self.unit.translation.component.repoweb = (
         'http://example.net/{{filename}}#L{{line}}')
     self.profile.editor_link = 'editor://open/?file={{filename}}&line={{line}}'
     self.unit.location = 'foo.bar:123'
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit), '''
         <a class="long-filename"
             href="editor://open/?file=foo.bar&amp;line=123" target="_blank"
             rel="noopener noreferrer">
         foo.bar:123
         </a>
         ''')
Exemplo n.º 11
0
 def test_repoweb(self):
     self.unit.translation.component.repoweb = (
         'http://example.net/%(file)s#L%(line)s'
     )
     self.unit.location = 'foo.bar:123'
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit),
         '''
         <a href="http://example.net/foo.bar#L123" target="_blank">
         foo.bar:123
         <i class="fa fa-external-link"></i>
         </a>
         '''
     )
Exemplo n.º 12
0
 def test_repoweb(self):
     self.unit.translation.component.repoweb = (
         "http://example.net/{{filename}}#L{{line}}")
     self.unit.location = "foo.bar:123"
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit),
         """
         <a class="wrap-text"
             href="http://example.net/foo.bar#L123" target="_blank"
             dir="ltr" rel="noopener noreferrer">
         foo.bar:123
         </a>
         """,
     )
Exemplo n.º 13
0
 def test_user_url(self):
     self.unit.translation.component.repoweb = (
         'http://example.net/%(file)s#L%(line)s'
     )
     self.profile.editor_link = 'editor://open/?file=%(file)s&line=%(line)s'
     self.unit.location = 'foo.bar:123'
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit),
         '''
         <a href="editor://open/?file=foo.bar&amp;line=123" target="_blank">
         foo.bar:123
         <i class="fa fa-external-link"></i>
         </a>
         '''
     )
Exemplo n.º 14
0
 def test_repowebs(self):
     self.unit.translation.component.repoweb = (
         'http://example.net/%(file)s#L%(line)s')
     self.unit.location = 'foo.bar:123,bar.foo:321'
     self.assertHTMLEqual(
         get_location_links(self.profile, self.unit), '''
         <a href="http://example.net/foo.bar#L123" target="_blank"
             rel="noopener noreferrer">
         foo.bar:123
         <i class="fa fa-external-link"></i>
         </a>
         <a href="http://example.net/bar.foo#L321" target="_blank"
             rel="noopener noreferrer">
         bar.foo:321
         <i class="fa fa-external-link"></i>
         </a>
         ''')
Exemplo n.º 15
0
 def test_filenames(self):
     self.unit.location = 'foo.bar:123,bar.foo:321'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         'foo.bar:123\nbar.foo:321'
     )
Exemplo n.º 16
0
 def test_filename(self):
     self.unit.location = 'f&oo.bar:123'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         'f&amp;oo.bar:123'
     )
Exemplo n.º 17
0
 def test_numeric(self):
     self.unit.location = '123'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         'unit ID 123'
     )
Exemplo n.º 18
0
 def test_empty(self):
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         ''
     )
Exemplo n.º 19
0
 def test_filenames(self):
     self.unit.location = "foo.bar:123,bar.foo:321"
     self.assertEqual(get_location_links(self.unit), "foo.bar:123\nbar.foo:321")
Exemplo n.º 20
0
 def test_filename(self):
     self.unit.location = 'f&oo.bar:123'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         'f&amp;oo.bar:123'
     )
Exemplo n.º 21
0
 def test_numeric(self):
     self.unit.location = "123"
     self.assertEqual(get_location_links(self.profile, self.unit),
                      "string ID 123")
Exemplo n.º 22
0
 def test_empty(self):
     self.assertEqual(get_location_links(self.unit), "")
Exemplo n.º 23
0
 def test_numeric(self):
     self.unit.location = "123"
     self.assertEqual(get_location_links(self.unit), "unit ID 123")
Exemplo n.º 24
0
 def test_filename(self):
     self.unit.location = "f&oo.bar:123"
     self.assertEqual(get_location_links(self.unit), "f&amp;oo.bar:123")
Exemplo n.º 25
0
 def test_filenames(self):
     self.unit.location = "foo.bar:123,bar.foo:321"
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         'foo.bar:123\n<span class="divisor">•</span>\nbar.foo:321',
     )
Exemplo n.º 26
0
 def test_empty(self):
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         ''
     )
Exemplo n.º 27
0
 def test_numeric(self):
     self.unit.location = '123'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         'unit ID 123'
     )
Exemplo n.º 28
0
 def test_filenames(self):
     self.unit.location = 'foo.bar:123,bar.foo:321'
     self.assertEqual(
         get_location_links(self.profile, self.unit),
         'foo.bar:123\nbar.foo:321'
     )