Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#7328 Add 'outdated' column in search table #7364

Merged
merged 4 commits into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
19 changes: 18 additions & 1 deletion conans/test/functional/command/search_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,22 @@ def search_test(self):

@unittest.skipIf(get_env("TESTING_REVISIONS_ENABLED", False), "No sense with revs")
class SearchOutdatedTest(unittest.TestCase):
def search_outdated_test(self):

def test_search_outdated(self):

def validate_outdated_table(expected):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit interleaved with other checks, and a bit fragile for changes. Try to simplify the checks, or do a separate, very simple test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I separated the test, also I using single package id, so it should not change in the future.

client.run("search Test/0.1@lasote/testing --table=table.html")
html = ''.join([line.strip() for line in client.load("table.html").splitlines()])
self.assertIn("<h1>Test/0.1@lasote/testing</h1>", html)
self.assertIn("<th>remote</th>"
"<th>package_id</th>"
"<th>outdated</th>"
, html)
self.assertIn("<td></td>"
"<td>3475bd55b91ae904ac96fde0f106a136ab951a5e</td>"
"<td>{}</td>".format(expected)
, html)

test_server = TestServer(users={"lasote": "password"}) # exported users and passwords
servers = {"default": test_server}
client = TestClient(servers=servers, users={"default": [("lasote", "password")]})
Expand All @@ -1268,6 +1283,7 @@ class Test(ConanFile):
client.save({"conanfile.py": conanfile})
client.run("export . lasote/testing")
client.run("install Test/0.1@lasote/testing --build -s os=Windows")
validate_outdated_table(False)
client.save({"conanfile.py": "# comment\n%s" % conanfile})
client.run("export . lasote/testing")
client.run("install Test/0.1@lasote/testing --build -s os=Linux")
Expand All @@ -1279,6 +1295,7 @@ class Test(ConanFile):
client.run("search Test/0.1@lasote/testing %s --outdated" % remote)
self.assertIn("os: Windows", client.out)
self.assertNotIn("os: Linux", client.out)
validate_outdated_table(True)

def test_exception_client_without_revs(self):
client = TestClient()
Expand Down