Giter Site home page Giter Site logo

fakeldap's Introduction

Zulip overview

Zulip is an open-source team collaboration tool with unique topic-based threading that combines the best of email and chat to make remote work productive and delightful. Fortune 500 companies, leading open source projects, and thousands of other organizations use Zulip every day. Zulip is the only modern team chat app that is designed for both live and asynchronous conversations.

Zulip is built by a distributed community of developers from all around the world, with 74+ people who have each contributed 100+ commits. With over 1000 contributors merging over 500 commits a month, Zulip is the largest and fastest growing open source team chat project.

Come find us on the development community chat!

GitHub Actions build status coverage status Mypy coverage Ruff code style: prettier GitHub release docs Zulip chat Twitter GitHub Sponsors

Getting started

You may also be interested in reading our blog, and following us on Twitter and LinkedIn.

Zulip is distributed under the Apache 2.0 license.

fakeldap's People

Contributors

bastichelaar avatar clundxiii avatar eeshangarg avatar mateuszmandera avatar sunweaver avatar timabbott avatar umairwaheed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fakeldap's Issues

ImportError: Import by filename is not supported

I'm trying to use fakeldap library with a simple example.

test_base.py

import unittest
from mock import patch
from fakeldap import MockLDAP

_mock_ldap = MockLDAP()

ldap_server = 'ldaps://myldapserver'

class BaseTests(unittest.TestCase):
    def setUp(self):
        # Patch where the ldap library is used:
        self.ldap_patcher = patch(ldap_server)
        self.mock_ldap = self.ldap_patcher.start()
        self.mock_ldap.return_value = _mock_ldap

    def tearDown(self):
        _mock_ldap.reset()
        self.mock_ldap.stop()

Dependencies:

  • python-mock-1.0.1

When I execute: python test_base.py
It raises this error:

self.mock_ldap = self.ldap_patcher.start()
  File "/usr/lib/python2.6/site-packages/mock-1.0.1-py2.6.egg/mock.py", line 1396, in start
    result = self.__enter__()
  File "/usr/lib/python2.6/site-packages/mock-1.0.1-py2.6.egg/mock.py", line 1252, in __enter__
    self.target = self.getter()
  File "/usr/lib/python2.6/site-packages/mock-1.0.1-py2.6.egg/mock.py", line 1414, in <lambda>
    getter = lambda: _importer(target)
  File "/usr/lib/python2.6/site-packages/mock-1.0.1-py2.6.egg/mock.py", line 1098, in _importer
    thing = __import__(import_path)
ImportError: Import by filename is not supported.

Migrate tests to nose replacement

nose which we use for tests appears to be outdated (https://pypi.org/project/nose/) and no longer works for me on python 3.10 throwing an error from inside the module:

  File "/home/elev3n/laboratory/fakeldap/.eggs/nose-1.3.7-py3.10.egg/nose/suite.py", line 106, in _set_tests
    if isinstance(tests, collections.Callable) and not is_suite:
AttributeError: module 'collections' has no attribute 'Callable'

that's due to python 3.10 moving Callable (https://stackoverflow.com/a/70641487). Works fine still on python 3.8 though and I haven't tested python 3.9, so not sure but it should be fine. Either way, this is going to become a problem soon.

https://github.com/nose-devs/nose2 appears to be a direct replacement that we could migrate to.

The most direct thing that needs to be tweaked seems to be just this to make tests runnable with python setup.py test:

diff --git a/setup.py b/setup.py
index 3c9f61d..a8a42e6 100644
--- a/setup.py
+++ b/setup.py
@@ -18,8 +18,8 @@ setup(
     install_requires = requirements,
 
     tests_require=tests_require,
-    setup_requires='nose',
-    test_suite = "nose.collector",
+    setup_requires='nose2',
+    test_suite = "nose2.collector.collector",
     extras_require={'test': tests_require},
 
     author = "Christo Buschek",
(END)

But our tests.py uses some helpers from nose.tools that don't seem to exist in nose2 so they'll need replacing? I haven't dag into this beyond that, so not sure.

Set up coverage tracking with pytest

In #33 we removed nose and switched to pytest. The test coverage tracking we had for nose was deleted there. This issue is for tracking that we configure it for pytest next

Add CI for the project

We should add Travis CI for running the project's tests. Not a high priority, but also pretty easy.

Returning exceptions

Has consideration been given to allowing tests to pass in an exception to return? E.g.

self.mock_ldap.set_return_value( "simple_bind_s", ("cn=admin,dc=mgb,dc=org", "ldaptest"), ldap.SERVER_DOWN )

add bind_s method

it's like simple_bind_s with a third argument. The third argument is the method used. A simple behaviour like simple_bind_s will be perfect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.