def test_verify_topic_and_testcase_name_with_topic_missing():
    topic = '/topic/VirtualTopic.eng.ci.brew-build.test.complete'
    testcase = 'rhproduct.default.functional'
    error = (
        'The message topic "/topic/VirtualTopic.eng.ci.brew-build.test.complete" '
        'uses old scheme not containing namespace from '
        'test case name "rhproduct.default.functional"')
    with pytest.raises(exceptions.MissingTopicError, match=error):
        utils.verify_topic_and_testcase_name(topic, testcase)
def test_verify_topic_and_testcase_name_mismatch():
    topic = '/topic/VirtualTopic.eng.ci.rhproduct.brew-build.test.complete'
    testcase = 'nont-rhproduct.default.functional'
    error = (
        'Test case "nont-rhproduct.default.functional" namespace "nont-rhproduct" '
        'does not match message topic '
        '"/topic/VirtualTopic.eng.ci.rhproduct.brew-build.test.complete" '
        'namespace "rhproduct"')
    with pytest.raises(exceptions.TopicMismatchError, match=error):
        utils.verify_topic_and_testcase_name(topic, testcase)
def test_verify_topic_and_testcase_name_with_non_eng_topic():
    topic = '/topic/VirtualTopic.qe.ci.jenkins.x.y.z'
    testcase = 'rhproduct.default.functional'
    with pytest.raises(exceptions.MissingTopicError):
        utils.verify_topic_and_testcase_name(topic, testcase)
def test_verify_topic_and_testcase_name():
    topic = '/topic/VirtualTopic.eng.ci.rhproduct.brew-build.test.complete'
    testcase = 'rhproduct.default.functional'
    utils.verify_topic_and_testcase_name(topic, testcase)