Code Duplication    Length = 25-26 lines in 2 locations

tests/test_webdav.py 2 locations

@@ 122-147 (lines=26) @@
119
120
121
class TestWebDavNeedAuth(unittest.TestCase):
122
    @classmethod
123
    def setUpClass(self):
124
        import easywebdav
125
126
        shutil.rmtree('./data/tests', ignore_errors=True)
127
        os.makedirs('./data/tests')
128
129
        ctx = run.cli.make_context('test', [
130
            '--taskdb', 'sqlite+taskdb:///data/tests/task.db',
131
            '--projectdb', 'sqlite+projectdb:///data/tests/projectdb.db',
132
            '--resultdb', 'sqlite+resultdb:///data/tests/resultdb.db',
133
        ], None, obj=utils.ObjectDict(testing_mode=True))
134
        self.ctx = run.cli.invoke(ctx)
135
136
        ctx = run.webui.make_context('webui', [
137
            '--username', 'binux',
138
            '--password', '4321',
139
            '--need-auth',
140
        ], self.ctx)
141
        self.app = run.webui.invoke(ctx)
142
        self.app_thread = utils.run_in_thread(self.app.run)
143
        time.sleep(5)
144
145
        self.webdav = easywebdav.connect('localhost', port=5000, path='dav')
146
        self.webdav_up = easywebdav.connect('localhost', port=5000, path='dav',
147
                                            username='binux', password='4321')
148
149
    @classmethod
150
    def tearDownClass(self):
@@ 21-45 (lines=25) @@
18
from tests import data_sample_handler, data_handler
19
20
class TestWebDav(unittest.TestCase):
21
    @classmethod
22
    def setUpClass(self):
23
        import easywebdav
24
25
        shutil.rmtree('./data/tests', ignore_errors=True)
26
        os.makedirs('./data/tests')
27
28
        ctx = run.cli.make_context('test', [
29
            '--taskdb', 'sqlite+taskdb:///data/tests/task.db',
30
            '--projectdb', 'sqlite+projectdb:///data/tests/projectdb.db',
31
            '--resultdb', 'sqlite+resultdb:///data/tests/resultdb.db',
32
        ], None, obj=utils.ObjectDict(testing_mode=True))
33
        self.ctx = run.cli.invoke(ctx)
34
35
        ctx = run.webui.make_context('webui', [
36
            '--username', 'binux',
37
            '--password', '4321',
38
        ], self.ctx)
39
        self.app = run.webui.invoke(ctx)
40
        self.app_thread = utils.run_in_thread(self.app.run)
41
        time.sleep(5)
42
43
        self.webdav = easywebdav.connect('localhost', port=5000, path='dav')
44
        self.webdav_up = easywebdav.connect('localhost', port=5000, path='dav',
45
                                            username='binux', password='4321')
46
47
    @classmethod
48
    def tearDownClass(self):