Code Duplication    Length = 24-25 lines in 2 locations

tests/protocols/gmpv9/test_create_config.py 1 location

@@ 26-50 (lines=25) @@
23
from . import Gmpv9TestCase
24
25
26
class GmpCreateConfigTestCase(Gmpv9TestCase):
27
    def test_create_config(self):
28
        self.gmp.create_config('a1', 'foo')
29
30
        self.connection.send.has_been_called_with(
31
            '<create_config>'
32
            '<copy>a1</copy>'
33
            '<name>foo</name>'
34
            '<usage_type>scan</usage_type>'
35
            '</create_config>'
36
        )
37
38
    def test_missing_config_id(self):
39
        with self.assertRaises(RequiredArgument):
40
            self.gmp.create_config(config_id='', name='foo')
41
42
        with self.assertRaises(RequiredArgument):
43
            self.gmp.create_config(config_id=None, name='foo')
44
45
    def test_missing_name(self):
46
        with self.assertRaises(RequiredArgument):
47
            self.gmp.create_config(config_id='c1', name=None)
48
49
        with self.assertRaises(RequiredArgument):
50
            self.gmp.create_config(config_id='c1', name='')
51
52
53
if __name__ == '__main__':

tests/protocols/gmpv7/test_create_config.py 1 location

@@ 26-49 (lines=24) @@
23
from . import Gmpv7TestCase
24
25
26
class GmpCreateConfigTestCase(Gmpv7TestCase):
27
    def test_create_config(self):
28
        self.gmp.create_config('a1', 'foo')
29
30
        self.connection.send.has_been_called_with(
31
            '<create_config>'
32
            '<copy>a1</copy>'
33
            '<name>foo</name>'
34
            '</create_config>'
35
        )
36
37
    def test_missing_config_id(self):
38
        with self.assertRaises(RequiredArgument):
39
            self.gmp.create_config(config_id='', name='foo')
40
41
        with self.assertRaises(RequiredArgument):
42
            self.gmp.create_config(config_id=None, name='foo')
43
44
    def test_missing_name(self):
45
        with self.assertRaises(RequiredArgument):
46
            self.gmp.create_config(config_id='c1', name=None)
47
48
        with self.assertRaises(RequiredArgument):
49
            self.gmp.create_config(config_id='c1', name='')
50
51
52
if __name__ == '__main__':