Esempio n. 1
0
    def test_save_service_public(self):
        collection_mock = mock.Mock(spec=Collection)
        collection_mock.count_documents.return_value = 0
        collection_mock.find_one.return_value = self.service_public
        store = MongodbServiceStore(collection=collection_mock,
                                    sane_name_config=self.sane_name_config)
        store.save_service(Service(self.service_public))

        collection_mock.insert_one.assert_called_with(self.service_public)
Esempio n. 2
0
    def test_save_service_with_special_name(self):
        collection_mock = mock.Mock(spec=Collection)
        collection_mock.count_documents.return_value = 0
        collection_mock.find_one.return_value = self.service_special
        store = MongodbServiceStore(collection=collection_mock,
                                    sane_name_config=self.sane_name_config)
        store.save_service(Service(self.service_special))

        collection_mock.insert_one.assert_called_with({
            "url": "http://wonderload",
            "type": "wps",
            "name": "A_special_Name",
            "public": False,
            "auth": "token"
        })