File: test_system.py

package info (click to toggle)
nufw 2.4.3-2.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,728 kB
  • sloc: ansic: 32,174; sh: 10,146; python: 4,176; makefile: 965; perl: 630; lex: 176; php: 168; yacc: 117; xml: 34
file content (35 lines) | stat: -rwxr-xr-x 1,085 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python
from unittest import TestCase, main
from config import CONF_DIR, config
from common import createClientWithCerts, connectClient
from nuauth import Nuauth
from nuauth_conf import NuauthConf
from os import path
from inl_tests.replace_file import ReplaceFile

class TestSystem(TestCase):
    def setUp(self):
        # Start nuauth with our config
        nuconfig = NuauthConf()
        nuconfig["nuauth_user_check_module"] = '"system"'
        self.nuauth = Nuauth(nuconfig)

    def tearDown(self):
        # Restore user DB and nuauth config
        self.nuauth.stop()

    def testLogin(self):
        username = config.get("test_system", "username")
        password = config.get("test_system", "password")
        client = createClientWithCerts(username, password)
        self.assert_(connectClient(client))
        client.stop()

        client = createClientWithCerts(username, "xxx%sxxx" % password)
        self.assert_(not connectClient(client))
        client.stop()

if __name__ == "__main__":
    print "Test nuauth module 'system' for AUTH"
    main()