Ejemplo n.º 1
0
def test_config_clear_upload_key():
    config.config_file_clear_section(SECTION)
    random_key = ''.join(
        random.choices(string.ascii_uppercase + string.digits, k=12))
    config.config_file_save_upload_key(random_key, USERNAME, SECTION)
    assert config.config_file_read_upload_key(SECTION) == random_key
    config.config_file_clear_upload_key(SECTION)
    assert config.config_file_read_upload_key(SECTION) is None
Ejemplo n.º 2
0
 def setUp(self):
     config_file_clear_section('test')
     config_file_save_api_key('11223344556677889900',
                              'cedric',
                              section='test')
     config_file_save_organisation_membership('saao',
                                              'superadmin',
                                              section='test')
     httpretty.enable()
Ejemplo n.º 3
0
def test_config_write_membership():
    config.config_file_clear_section(SECTION)
    random_subdomain = ''.join(
        random.choices(string.ascii_uppercase + string.digits, k=12)).lower()
    random_role = ''.join(
        random.choices(string.ascii_uppercase + string.digits, k=12))
    config.config_file_save_organisation_membership(random_subdomain,
                                                    random_role, SECTION)
    memberships = config.config_file_read_organisation_memberships(SECTION)
    assert len(memberships) == 1
    assert memberships == {random_subdomain: random_role}
Ejemplo n.º 4
0
 def setUp(self):
     config_file_clear_section('test')
     httpretty.enable()
Ejemplo n.º 5
0
def test_config_write_read_username():
    config.config_file_clear_section(SECTION)
    random_username = ''.join(
        random.choices(string.ascii_uppercase + string.digits, k=12))
    config.config_file_save_username(random_username, SECTION)
    assert config.config_file_read_username(SECTION) == random_username
Ejemplo n.º 6
0
def test_config_file_is_logged_in_has_api_and_upload_keys():
    config.config_file_clear_section(SECTION)
    config.config_file_save_api_key(API_KEY, USERNAME, SECTION)
    config.config_file_save_upload_key(UPLOAD_KEY, USERNAME, SECTION)
    assert config.config_file_is_logged_in(SECTION) is True
Ejemplo n.º 7
0
def test_config_file_is_logged_in_no_keys():
    with patch('arcsecond.config.config_file_exists', return_value=True):
        config.config_file_clear_section(SECTION)
        assert config.config_file_is_logged_in(SECTION) is False
Ejemplo n.º 8
0
def clear_test_credentials():
    config_file_clear_section('test')