예제 #1
0
def test_get_valid_rw_apikey():
    with patch.object(ConfigParser.ConfigParser,
                      'get',
                      return_value=ID_WITH_VALID_LENGTH):
        rw_api_key = api_utils.get_rw_apikey()

        assert rw_api_key == ID_WITH_VALID_LENGTH
예제 #2
0
def test_get_invalid_rw_apikey(capsys):
    with patch.object(ConfigParser.ConfigParser, 'get', return_value=ID_WITH_INVALID_LENGTH):
        with pytest.raises(SystemExit):
            api_utils.load_config = Mock()
            result = api_utils.get_rw_apikey()
            out, err = capsys.readouterr()

            assert result is None
            assert ID_WITH_INVALID_LENGTH in out
            assert 'is not of correct length' in out
예제 #3
0
def test_get_invalid_rw_apikey(capsys):
    with patch.object(ConfigParser.ConfigParser,
                      'get',
                      return_value=ID_WITH_INVALID_LENGTH):
        with pytest.raises(SystemExit):
            api_utils.load_config = Mock()
            result = api_utils.get_rw_apikey()
            out, err = capsys.readouterr()

            assert result is None
            assert ID_WITH_INVALID_LENGTH in out
            assert 'is not of correct length' in out
예제 #4
0
def test_get_valid_rw_apikey():
    with patch.object(ConfigParser.ConfigParser, 'get', return_value=ID_WITH_VALID_LENGTH):
        rw_api_key = api_utils.get_rw_apikey()

        assert rw_api_key == ID_WITH_VALID_LENGTH