Example #1
0
def test_get_valid_owner_apikey_id():
    with patch.object(ConfigParser.ConfigParser,
                      'get',
                      return_value=ID_WITH_VALID_LENGTH):
        owner_api_key_id = api_utils.get_owner_apikey_id()

        assert owner_api_key_id == ID_WITH_VALID_LENGTH
Example #2
0
def test_get_invalid_owner_apikey_id(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_owner_apikey_id()
            out, err = capsys.readouterr()

            assert result is None
            assert ID_WITH_INVALID_LENGTH in out
            assert 'is not of correct length' in out
Example #3
0
def test_get_invalid_owner_apikey_id(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_owner_apikey_id()
            out, err = capsys.readouterr()

            assert result is None
            assert ID_WITH_INVALID_LENGTH in out
            assert 'is not of correct length' in out
Example #4
0
def test_get_valid_owner_apikey_id():
    with patch.object(ConfigParser.ConfigParser, 'get', return_value=ID_WITH_VALID_LENGTH):
        owner_api_key_id = api_utils.get_owner_apikey_id()

        assert owner_api_key_id == ID_WITH_VALID_LENGTH