Ejemplo n.º 1
0
 def mock_get(self, path_segment, owner=None, app=None, sharing=None, **query):
     if mode == 0:
         return common.make_response_record(
             '{"entry": [{"content": {"roles": ["admin", "user"]}}]}'
         )
     else:
         raise binding.HTTPError(common.make_response_record("", status=404))
 def mock_kvstore_collections_get(self,
                                  name="",
                                  owner=None,
                                  app=None,
                                  sharing=None,
                                  **query):
     raise binding.HTTPError(common.make_response_record("", status=404))
Ejemplo n.º 3
0
    def mock_configuration_file_list(self, count=None, **kwargs):
        if not hasattr(mock_configuration_file_list, "normal_mode"):
            mock_configuration_file_list.normal_mode = True
            raise binding.HTTPError(common.make_response_record("",
                                                                status=404))
        else:
            if "name" in kwargs:
                if kwargs["name"] in all_stanzas:
                    stanza_mgr = client.Stanza(
                        self.service,
                        "configs/conf-test/{0}/".format(kwargs["name"]),
                        skip_refresh=True,
                    )
                    stanza_mgr._state = common.record({
                        "title":
                        kwargs["name"],
                        "access":
                        common.record({"app": "test"}),
                        "content":
                        all_stanzas[kwargs["name"]],
                    })
                    return [stanza_mgr]
                else:
                    raise binding.HTTPError(
                        common.make_response_record("", status=404))
            else:
                stanza_mgrs = []
                for stanza_name, stanza in list(all_stanzas.items()):
                    stanza_mgr = client.Stanza(
                        self.service,
                        "configs/conf-test/{0}/".format(stanza_name),
                        skip_refresh=True,
                    )
                    stanza_mgr._state = common.record({
                        "title":
                        stanza_name,
                        "access":
                        common.record({"app": "test"}),
                        "content":
                        stanza,
                    })
                    stanza_mgrs.append(stanza_mgr)

                return stanza_mgrs
 def mock_get(self,
              path_segment,
              owner=None,
              app=None,
              sharing=None,
              **query):
     if mode == 0:
         return common.make_response_record(
             '{"2011-07-06T21:54:23.000-07:00": "1310014463.0"}')
     if mode == 1:
         return common.make_response_record(
             '{"2011-07-06T21:54:23.000-07:00": "2011-07-07T12:54:23.000+08:00"}'
         )
     else:
         raise binding.HTTPError(common.make_response_record("",
                                                             status=400))
Ejemplo n.º 5
0
 def mock_kvstore_collection_data_delete_by_id(self, id):
     try:
         del object_acls[id]
     except:
         raise binding.HTTPError(common.make_response_record("", status=404))
Ejemplo n.º 6
0
 def mock_kvstore_collection_data_delete_by_id(self, id):
     try:
         del app_capabilities[id]
     except:
         raise binding.HTTPError(None, status=404)
Ejemplo n.º 7
0
 def mock_kvstore_collection_data_query_by_id(self, id):
     try:
         return app_capabilities[id]
     except:
         raise binding.HTTPError(common.make_response_record("", status=404))
 def mock_kvstore_collection_data_delete_by_id(self, id):
     try:
         del checkpoint_states[id]
     except:
         raise binding.HTTPError(None, status=404)