Exemplo n.º 1
0
    def test_nonroot_without_cache_is_same_as_unattached_root(self, m_getuid):
        m_getuid.return_value = 1000
        cfg = FakeConfig()

        nonroot_status = cfg.status()

        m_getuid.return_value = 0
        root_unattached_status = cfg.status()

        assert root_unattached_status == nonroot_status
Exemplo n.º 2
0
    def test_nonroot_unattached_is_same_as_unattached_root(
            self, m_getuid, m_get_available_resources):
        m_get_available_resources.return_value = [{
            "name": "esm-infra",
            "available": True
        }]
        m_getuid.return_value = 1000
        cfg = FakeConfig()

        nonroot_status = cfg.status()

        m_getuid.return_value = 0
        root_unattached_status = cfg.status()

        assert root_unattached_status == nonroot_status
Exemplo n.º 3
0
 def test_root_unattached(self, _m_getuid, m_get_available_resources):
     """Test we get the correct status dict when unattached"""
     cfg = FakeConfig({})
     m_get_available_resources.return_value = [
         {
             "name": "esm-infra",
             "available": True
         },
         {
             "name": "fips",
             "available": False
         },
     ]
     esm_desc = ENTITLEMENT_CLASS_BY_NAME["esm-infra"].description
     fips_desc = ENTITLEMENT_CLASS_BY_NAME["fips"].description
     expected = copy.deepcopy(DEFAULT_STATUS)
     expected["services"] = [
         {
             "available": "yes",
             "name": "esm-infra",
             "description": esm_desc
         },
         {
             "available": "no",
             "name": "fips",
             "description": fips_desc
         },
     ]
     assert expected == cfg.status()
Exemplo n.º 4
0
 def test_root_unattached(self, _m_getuid):
     """Test we get the correct status dict when unattached"""
     cfg = FakeConfig({})
     expected = {
         "attached": False,
         "expires": status.UserFacingStatus.INAPPLICABLE.value,
         "origin": None,
         "services": [],
         "techSupportLevel": status.UserFacingStatus.INAPPLICABLE.value,
     }
     assert expected == cfg.status()