コード例 #1
0
    def test_validate_registry_url_in_browser(self):
        url = b'http://hostname:6000/v2'

        registry = Registry(host='hostname', port=6000)
        registry.get_images = MagicMock(return_value=({}, None))
        setattr(app, 'registry', registry)

        rv = self.app.get('/')

        self.assertIn(url, rv.data)
コード例 #2
0
    def test_get_images(self, mock_obj):
        registry = Registry()

        images, link = registry.get_images()

        self.assertEqual(images, ['hello-world', 'postgres'])
        self.assertEqual(link, '?n=2&last=b')
        self.assertIn(
            mock.call(registry.get_url('_catalog'),
                      **registry.http_params,
                      params=registry.get_pagination(10, None)),
            mock_obj.call_args_list)