Exemplo n.º 1
0
    def testNoChangeRequired(self):
        # insert a row that does not need to be updated
        self.f.insert_into_multicolumn_example(
            ['*****@*****.**', 4, 'testNoChangeRequired'],
            [8, 'admin', 'made up'])

        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='multicolumn_example',
            identifiers=dict(identifier1='*****@*****.**',
                             identifier2='4',
                             identifier3='testNoChangeRequired'),
            values={
                'value1': '8',
                'value2': 'admin',
                'value3': "made up"
            },
        )

        result = utils.ansible_check(args)
        self.assertIn('changed', result)
        self.assertFalse(result['changed'], 'no changed required is detected')
        self.assertEquals(self.f.count_multicolumn_example(), 1,
                          'no additional row has been inserted in check-mode')
    def testInsertRequired(self):
        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='multicolumn_example',
            identifiers=dict(identifier1='*****@*****.**', identifier2='4', identifier3='testInsert'),
            values=dict(value1='8', value2='admin', value3="made up"),
        )

        result = utils.ansible_check(args)
        self.assertTrue(result['changed'], 'a required change is detected')
        self.assertRegexpMatches(result['msg'], 'insert')
        self.assertEquals(self.f.count_multicolumn_example(), 0, 'no row has been inserted in check-mode')
    def testInsertRequired(self):
        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='key_value_example',
            identifiers=dict(name='testInsertRequired_myKey'),
            values=dict(value='42'),
        )

        result = utils.ansible_check(args)
        print(result)
        self.assertTrue(result['changed'], 'a required change is detected')
        self.assertRegexpMatches(result['msg'], 'insert')
        self.assertEquals(self.f.count_key_value_example(), 0, 'no row has been inserted in check-mode')
Exemplo n.º 4
0
    def testInsertRequired(self):
        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='key_value_example',
            identifiers=dict(name='testInsertRequired_myKey'),
            values=dict(value='42'),
        )

        result = utils.ansible_check(args)
        print(result)
        self.assertTrue(result['changed'], 'a required change is detected')
        self.assertRegexpMatches(result['msg'], 'insert')
        self.assertEquals(self.f.count_key_value_example(), 0,
                          'no row has been inserted in check-mode')
Exemplo n.º 5
0
    def testInsertRequired(self):
        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='multicolumn_example',
            identifiers=dict(identifier1='*****@*****.**',
                             identifier2='4',
                             identifier3='testInsert'),
            values=dict(value1='8', value2='admin', value3="made up"),
        )

        result = utils.ansible_check(args)
        self.assertTrue(result['changed'], 'a required change is detected')
        self.assertRegexpMatches(result['msg'], 'insert')
        self.assertEquals(self.f.count_multicolumn_example(), 0,
                          'no row has been inserted in check-mode')
    def testNoChangeRequired(self):
        # insert a row that does not need to be updated
        self.f.insert_into_key_value_example('testNoChangeRequired_myKey', 42)

        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='key_value_example',
            identifiers=dict(name='testNoChangeRequired_myKey'),
            values=dict(value='42'),
        )

        result = utils.ansible_check(args)
        self.assertIn('changed', result)
        self.assertFalse(result['changed'], 'no changed required is detected')
        self.assertEquals(self.f.count_key_value_example(), 1, 'no additional row has been inserted in check-mode')
    def testNoChangeRequired(self):
        # insert a row that does not need to be updated
        self.f.insert_into_multicolumn_example(['*****@*****.**', 4, 'testNoChangeRequired'], [8, 'admin', 'made up'])

        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='multicolumn_example',
            identifiers=dict(identifier1='*****@*****.**', identifier2='4', identifier3='testNoChangeRequired'),
            values={'value1': '8', 'value2': 'admin', 'value3': "made up"},
        )

        result = utils.ansible_check(args)
        self.assertIn('changed', result)
        self.assertFalse(result['changed'], 'no changed required is detected')
        self.assertEquals(self.f.count_multicolumn_example(), 1, 'no additional row has been inserted in check-mode')
Exemplo n.º 8
0
    def testNoChangeRequired(self):
        # insert a row that does not need to be updated
        self.f.insert_into_key_value_example('testNoChangeRequired_myKey', 42)

        args = dict(
            login_user=MYSQL_CONNECTION_PARAMS['user'],
            name=MYSQL_CONNECTION_PARAMS['db'],
            login_password=MYSQL_CONNECTION_PARAMS['passwd'],
            login_host=MYSQL_CONNECTION_PARAMS['host'],
            table='key_value_example',
            identifiers=dict(name='testNoChangeRequired_myKey'),
            values=dict(value='42'),
        )

        result = utils.ansible_check(args)
        self.assertIn('changed', result)
        self.assertFalse(result['changed'], 'no changed required is detected')
        self.assertEquals(self.f.count_key_value_example(), 1,
                          'no additional row has been inserted in check-mode')