Ejemplo n.º 1
0
 def get_button(self, t_mock, **kwargs):
     """Proxy for calling install_button."""
     template_mock = Mock()
     t_mock.return_value = template_mock
     install_button(self.context, self.addon, **kwargs)
     # Extract button from the kwargs from the first call.
     return template_mock.render.call_args[1]['button']
Ejemplo n.º 2
0
 def get_button(self, t_mock, **kwargs):
     """Proxy for calling install_button."""
     template_mock = Mock()
     t_mock.return_value = template_mock
     install_button(self.context, self.addon, **kwargs)
     # Extract button from the kwargs from the first call.
     return template_mock.render.call_args[0][0]['button']
Ejemplo n.º 3
0
 def get_button(self, t_mock, **kwargs):
     """Proxy for calling install_button."""
     template_mock = Mock()
     t_mock.return_value = template_mock
     if 'show_backup' not in kwargs:
         kwargs['show_backup'] = True
     install_button(self.context, self.addon, **kwargs)
     # Extract button from the kwargs from the first call.
     return template_mock.render.call_args[0][0]['button']
Ejemplo n.º 4
0
 def get_button(self, t_mock, **kwargs):
     """Proxy for calling install_button."""
     template_mock = Mock()
     t_mock.return_value = template_mock
     if not 'show_backup' in kwargs:
         kwargs['show_backup'] = True
     install_button(self.context, self.addon, **kwargs)
     # Extract button from the kwargs from the first call.
     return template_mock.render.call_args[1]['button']
Ejemplo n.º 5
0
 def test_backup_version(self):
     doc = PyQuery(install_button(self.context, self.addon))
     eq_(doc('a')[1].get('href'), 'xpi.backup.url')
Ejemplo n.º 6
0
 def test_backup_not_appears(self):
     doc = PyQuery(install_button(self.context, self.addon,
                                  show_backup=False))
     eq_(len(doc('.install-shell')), 1)
Ejemplo n.º 7
0
 def test_backup_appears(self):
     doc = PyQuery(install_button(self.context, self.addon))
     eq_(len(doc('.install-shell')), 2)
     eq_(len(doc('.backup-button')), 1)
Ejemplo n.º 8
0
 def test_backup_version(self):
     doc = PyQuery(install_button(self.context, self.addon))
     eq_(doc('a')[1].get('href'), 'xpi.backup.url')
Ejemplo n.º 9
0
 def test_backup_not_appears(self):
     doc = PyQuery(
         install_button(self.context, self.addon, show_backup=False))
     eq_(len(doc('.install-shell')), 1)
Ejemplo n.º 10
0
 def test_backup_appears(self):
     doc = PyQuery(install_button(self.context, self.addon))
     eq_(len(doc('.install-shell')), 2)
     eq_(len(doc('.backup-button')), 1)
Ejemplo n.º 11
0
 def test_backup_version(self):
     doc = PyQuery(install_button(self.context, self.addon))
     eq_(doc("a")[1].get("href"), "xpi.backup.url")
Ejemplo n.º 12
0
 def render(self, **kwargs):
     return PyQuery(install_button(self.context, self.addon, **kwargs))
Ejemplo n.º 13
0
 def render(self, **kwargs):
     return PyQuery(install_button(self.context, self.addon, **kwargs))