def test_getNextConcern_noneuserid():
    noneUserid = None
    expectedNextConcern = "cats"
    _addMockToFactory(noneUserid, expectedNextConcern)

    actualNextConcern = rivescriptmacros.getNextConcern(noneUserid)
    assert expectedNextConcern == actualNextConcern
def test_noConcernsSetUp():
    setUpLazily()
    conversationDriver.userConcerns = dict()
    conversationDriver.sortedUserConcernNames = []

    actual = rivescriptmacros.getNextConcern(userid)
    assert actual is None
def test_getNextConcern_noneuserid():
    noneUserid = None
    expectedNextConcern = "cats"
    _addMockToFactory(noneUserid, expectedNextConcern)

    actualNextConcern = rivescriptmacros.getNextConcern(noneUserid)
    assert expectedNextConcern == actualNextConcern
def test_getNextConcern():
    setUpLazily()

    expected = "loneliness"
    actual = rivescriptmacros.getNextConcern(userid)

    assert expected == actual
def test_sortedListOfNamesIsEmptyButConcernsStored():
    setUpLazily()
    assert conversationDriver.sortedUserConcernNames
    conversationDriver.sortedUserConcernNames = []
    assert not conversationDriver.sortedUserConcernNames

    actual = rivescriptmacros.getNextConcern(userid)
    assert actual is None
def test_runoutofconcerns():
    setUpLazily()

    for concernName, distressScore in concernsFew.iteritems():
        conversationDriver._markAddressed(concernName)

    actual = rivescriptmacros.getNextConcern(userid)
    assert actual is None
def test_getsecondconcernafterfirst():
    setUpLazily()
    conversationDriver._markAddressed("loneliness")

    expected = "urinary"
    actual = rivescriptmacros.getNextConcern(userid)

    assert expected == actual
def test_noConcernsStoredButNamesStored():
    setUpLazily()
    conversationDriver.userConcerns = dict()

    assert not conversationDriver.userConcerns
    with pytest.raises(KeyError):
        actual = rivescriptmacros.getNextConcern(userid)
    # make state consistent again to not affect following tests:
    conversationDriver.sortedUserConcernNames = []
def test_getNextConcern_noconcerns():
    expectedNextConcern = None
    _addMockToFactory(someuserid, expectedNextConcern)

    actualNextConcern = rivescriptmacros.getNextConcern(someuserid)
    assert expectedNextConcern == actualNextConcern
def test_getNextConcern():
    expectedNextConcern = "meaning"
    _addMockToFactory(someuserid, expectedNextConcern)

    actualNextConcern = rivescriptmacros.getNextConcern(someuserid)
    assert expectedNextConcern == actualNextConcern
def test_getNextConcern_noconcerns():
    expectedNextConcern = None
    _addMockToFactory(someuserid, expectedNextConcern)

    actualNextConcern = rivescriptmacros.getNextConcern(someuserid)
    assert expectedNextConcern == actualNextConcern
def test_getNextConcern():
    expectedNextConcern = "meaning"
    _addMockToFactory(someuserid, expectedNextConcern)

    actualNextConcern = rivescriptmacros.getNextConcern(someuserid)
    assert expectedNextConcern == actualNextConcern