Skip to content

Commit

Permalink
Add tracer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard committed Aug 23, 2021
1 parent 8fc94b6 commit 60e3794
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_katello/test_tracer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import sys
from unittest import TestCase

sys.path.append(os.path.join(os.path.dirname(__file__), '../../src/'))
from katello.tracer import upload_tracer_profile, query_affected_apps

from mock import patch

class TestUploadTracerProfile(TestCase):
@patch('katello.tracer.get_uep')
@patch('katello.tracer.lookup_consumer_id')
def test_upload_registered(self, mock_lookup, mock_uep):
mock_lookup.return_value = True

upload_tracer_profile(query_affected_apps)

mock_manager.return_value.profilelib._do_update.assert_called()

@patch('katello.tracer.get_uep')
@patch('katello.tracer.lookup_consumer_id')
def test_upload_unregistered(self, mock_lookup, mock_uep):
mock_lookup.return_value = None

upload_tracer_profile(query_affected_apps)

mock_manager.assert_not_called()

0 comments on commit 60e3794

Please sign in to comment.