Skip to content

Commit

Permalink
conan-io#7328 Add 'outdated' column in search table (conan-io#7364)
Browse files Browse the repository at this point in the history
* conan-io#7328 Add 'outdated' column in search table

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* conan-io#7328 do not remove more than requested

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* conan-io#7328 Separate functional test

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* conan-io#7328 Update other test to support outdated column

Signed-off-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
uilianries authored and memsharded committed Jul 21, 2020
1 parent 43189fb commit 007fcdc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conans/assets/templates/search_table_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<table id="results" class="table table-striped table-bordered" style="width:100%">
<thead>
{%- set headers = results.get_headers(keys=['remote', 'package_id']) %}
{%- set headers = results.get_headers(keys=['remote', 'package_id', 'outdated']) %}
{%- set headers2rows = headers.row(n_rows=2) %}
<tr>
{%- for category, subheaders in headers2rows %}
Expand Down
40 changes: 40 additions & 0 deletions conans/test/functional/command/search_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,14 @@ def search_html_table_test(self):
html = ''.join([line.strip() for line in self.client.load("table.html").splitlines()])
self.assertIn("<h1>Hello/1.4.10@myuser/testing</h1>", html)
self.assertIn("<td>LinuxPackageSHA</td>"
"<td>False</td>"
"<td>Linux</td>"
"<td>x86</td>"
"<td>gcc</td>"
"<td>libstdc++11</td>"
"<td>4.5</td>", html)
self.assertIn("<td>WindowsPackageSHA</td>"
"<td>True</td>"
"<td>Windows</td>"
"<td>x64</td>"
"<td>Visual Studio</td>"
Expand All @@ -411,13 +413,15 @@ def search_html_table_all_test(self):
self.assertIn("<h1>Hello/1.4.10@myuser/testing</h1>", html)
self.assertIn("<td>local</td>"
"<td>LinuxPackageSHA</td>"
"<td>False</td>"
"<td>Linux</td>"
"<td>x86</td>"
"<td>gcc</td>"
"<td>libstdc++11</td>"
"<td>4.5</td>", html)
self.assertIn("<td>search_able</td>"
"<td>WindowsPackageSHA</td>"
"<td>True</td>"
"<td>Windows</td>"
"<td>x64</td>"
"<td>Visual Studio</td>"
Expand Down Expand Up @@ -1288,6 +1292,42 @@ def test_exception_client_without_revs(self):
client.run("search lib/0.1@user/testing --revisions", assert_error=True)
self.assertIn("ERROR: The client doesn't have the revisions feature enabled", client.out)

def test_outdated_html_table(self):
test_server = TestServer(users={"user": "password"})
servers = {"default": test_server}
client = TestClient(servers=servers, users={"default": [("user", "password")]})
conanfile = textwrap.dedent("""
from conans import ConanFile
class Test(ConanFile):
name = "test"
version = "0.1.0"
""")
client.save({"conanfile.py": conanfile})
client.run("create . user/testing")
client.run("upload test/0.1.0@user/testing --all")
client.run("search test/0.1.0@user/testing --table=table.html -r default")

html = ''.join([line.strip() for line in client.load("table.html").splitlines()])
self.assertIn("<h1>test/0.1.0@user/testing</h1>", html)
self.assertIn("<th>remote</th>"
"<th>package_id</th>"
"<th>outdated</th>"
, html)
self.assertIn("<td>default</td>"
"<td>5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9</td>"
"<td>False</td>"
, html)

client.save({"conanfile.py": "# comment\n%s" % conanfile})
client.run("create . user/testing")
client.run("upload test/0.1.0@user/testing")
client.run("search test/0.1.0@user/testing --table=table.html -r default")
html = ''.join([line.strip() for line in client.load("table.html").splitlines()])
self.assertIn("<td>default</td>"
"<td>5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9</td>"
"<td>True</td>"
, html)


@unittest.skipUnless(get_env("TESTING_REVISIONS_ENABLED", False),
"set TESTING_REVISIONS_ENABLED=1")
Expand Down

0 comments on commit 007fcdc

Please sign in to comment.