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

Automatic updates from tags #3168

Merged
merged 19 commits into from May 29, 2019
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Test automatic updates with/without existing user.

Signed-off-by: Nils Philippsen <nils@redhat.com>
  • Loading branch information...
nphilipp committed Apr 25, 2019
commit f761347a524e642f8ae40305ddaca2f3c5ff0769
@@ -26,7 +26,7 @@

from bodhi.server.consumers.automatic_updates import AutomaticUpdateHandler
from bodhi.server.exceptions import BodhiException
from bodhi.server.models import Build, Release, Update, UpdateType
from bodhi.server.models import Build, Release, Update, UpdateType, User
from bodhi.tests.server import base


@@ -125,6 +125,39 @@ def test_incomplete_koji_buildinfo_owner(self, caplog):
with pytest.raises(BodhiException):
self.handler(msg)

def test_missing_user(self, caplog):
"""Test Koji build user missing from DB."""
caplog.set_level(logging.DEBUG)

expected_username = base.buildsys.DevBuildsys._build_data['owner_name']

# ensure user with expected name doesn't exist
self.db.query(User).filter_by(name=expected_username).delete()
self.db.flush()

self.handler(self.sample_message)

assert(f"Creating bodhi user for '{expected_username}'."
in caplog.messages)

def test_existing_user(self, caplog):
"""Test Koji build user existing in DB."""
caplog.set_level(logging.DEBUG)

expected_username = base.buildsys.DevBuildsys._build_data['owner_name']

# ensure user with expected name exists
user = self.db.query(User).filter_by(name=expected_username).first()
if not user:
user = User(name=expected_username)
self.db.add(user)
self.db.flush()

self.handler(self.sample_message)

assert(f"Creating bodhi user for '{expected_username}'."
not in caplog.messages)

# Test messages that should be ignored.

def test_ignored_tag(self, caplog):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.